charm-lib-contextual-status
Contextual status handling for charmed operators.
The goal of this library is to provide a mechanism for code within charm libraries to raise status conditions, such as Blocked or Waiting statuses, without relying on exceptions or other constructs that might otherwise interfere with the flow control of Python code.
This is accomplished by having the charm create a background status context with:
import charms.contextual_status as status
with status.context(self.unit):
some_lib.do_work()
Within a status context, it's possible for code to emit status conditions:
status.add(MaintenanceStatus("Doing something"))
if some_failure_condition:
status.add(BlockedStatus("Failed to do something"))
When a MaintenanceStatus is added to a status context, it is immediately
set as the unit status, so that the charm can provide status updates during
in-progress work.
When a BlockedStatus or WaitingStatus is added to a status context, it is
stored within the context for later. Multiple statuses can be added this way.
When a status context is closed, the unit status is set based on a simple
priority system: Blocked status is higher precedence than Waiting, and
within those groups, the earliest emitted status is preferred. If no Blocked
or Waiting statuses were emitted within the context, then the unit status is
set to Active.
The on_error decorator can be used to set status when an exception is raised:
@status.on_error(BlockedStatus("Failed to do something"))
def do_something():
status.add(MaintenanceStatus("Doing something"))
# ...
Metadata
Release files for charms.contextual-status 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| charms_contextual_status-0.0.1.tar.gz | 43.1 kB | Without provenance | Details for charms_contextual_status-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| charms_contextual_status-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for charms_contextual_status-0.0.1-py3-none-any.whl |
Total release size: 52.5 kB
Release files / charms_contextual_status-0.0.1.tar.gz
| Download URL | charms_contextual_status-0.0.1.tar.gz |
|---|---|
| Size | 43.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0ad9d6796a035fed39f53c6a8a8711ffbd8167d025e6e72490317835d3b83b0a
|
|
BLAKE2b-256 checksum How to use checksums |
73a3d19b24ba65a712cc031e04d9f8f289f4cea1665a207effd2b92a8ff90a07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / charms_contextual_status-0.0.1-py3-none-any.whl
| Download URL | charms_contextual_status-0.0.1-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1a0d0a76439eb5d008d44424fe1b09eab73c6e6ad964b546c727b3b10195efe
|
|
BLAKE2b-256 checksum How to use checksums |
e10e70b4bbe6e2fa9fdf9c9191249d8ee1439a4a3ef185f57c3f62030f9fe23d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for charms.contextual-status 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.