This project has been archived by its maintainers, and is no longer receiving any updates.
node-status-lib
node-status-lib is a lightweight Python library designed to simplify tracking the status of nodes and their internal flows in distributed systems. It is particularly useful for monitoring pipelines, workflows, and microservices by persisting status updates to a PostgreSQL database.
Features
- Track the status of an entire node
- Monitor the status of individual flows or tasks within a node
- Persist all status updates in a PostgreSQL database
- Optional support for AWS Secrets Manager integration
- Easy to integrate into any Python-based pipeline or microservice
Installation
Install from PyPI:
pip install node-status-lib
or
poetry add node-status-lib
Usage
1. Import the Library
from node_status_lib.manager import NodeStatusManager
from node_status_lib.enums import Status
2. Initialize the Node Status Manager
manager = NodeStatusManager(
node_id="102",
node_name="multispectral_node",
flows=["heatmap_gen", "insight_gen", "response"],
db_details={
"DB_NAME": "<your_db_name>",
"DB_USER": "<your_db_user>",
"DB_PASSWORD": "<your_db_password>",
"DB_HOST": "<your_db_host>",
"DB_PORT": "<your_db_port>"
}
)
3. Update Node and Flow Status
# Update the overall node status
manager.update_node_status(
Status.RUNNING,
description="Node is active and initialized all services."
)
# Update status of individual flows
manager.update_flow_status("heatmap_gen", Status.SUCCESS, description="Heatmap generation completed.")
manager.update_flow_status("insight_gen", Status.NOT_RUNNING)
manager.update_flow_status("response", Status.NOT_RUNNING, description="Awaiting input trigger.")
Note: description is optional for both node and flow updates.
Status Enum Options
Status.PENDING
Status.RUNNING
Status.SUCCESS
Status.FAILED
Database Table Schema
Ensure your PostgreSQL database includes the following table schema:
CREATE TABLE node_status (
node_id TEXT PRIMARY KEY,
node_name TEXT NOT NULL,
node_status TEXT NOT NULL CHECK (
node_status IN ('running', 'not_running', 'success', 'failed')
),
node_description TEXT DEFAULT NULL,
flow_status JSONB NOT NULL,
last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
flow_statusformat:{ "flow_name": { "status": "...", "description": "..." }, ... }
Requirements
- Python 3.7+
- PostgreSQL
psycopg2-binaryboto3(optional, required only for AWS Secrets Manager integration)
Metadata
Release files for node-status-lib 0.1.17
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 | |
|---|---|---|---|---|
| node_status_lib-0.1.17.tar.gz | 3.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| node_status_lib-0.1.17-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.8 kB
Release files / node_status_lib-0.1.17.tar.gz
| Download URL | node_status_lib-0.1.17.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d4ae22918dba6552797897b1adc1595de0c34b3bfce29aa6a3c5da9c25f0e13f
|
|
BLAKE2b-256 checksum How to use checksums |
c8177dbe7ac0257a45436a8691e0329da1c7f6ca5b55bad8b90eecd68b8dc79a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.10.12 Linux/6.8.0-60-generic
|
Release files / node_status_lib-0.1.17-py3-none-any.whl
| Download URL | node_status_lib-0.1.17-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
238489388d920c90df4f5d47aefc3f91de5954314030f0d3d8bc771469665ee2
|
|
BLAKE2b-256 checksum How to use checksums |
78a1c6b2b517826b6134a2fc7267860617b708b8a6ca0fe1d7037d33d036db68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.10.12 Linux/6.8.0-60-generic
|
Security for node-status-lib 0.1.17
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.