Skip to main content

A lightweight library for node and internal flow-level status tracking using PostgreSQL.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

node-status-lib

node-status-lib is a lightweight Python library designed to simplify the tracking of node and flow statuses in distributed systems. It is especially useful for monitoring pipelines, workflows, and microservices by storing runtime states in a PostgreSQL database.

Features

  • Track the status of an entire node
  • Track the status of individual flows/tasks within a node
  • Store all status updates directly into a PostgreSQL database
  • Built-in support for integration with secret managers (e.g., AWS Secrets Manager)
  • Easy integration into any Python-based pipeline or microservice

Installation

Install via PyPI:

pip install 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": < DB_NAME >,
        "DB_USER": < DB_USER >,
        "DB_PASSWORD": < DB_PASS >,
        "DB_HOST": < DB_HOST >,
        "DB_PORT": < DB_PORT >
    }
)

4. Update Node and Flow Status

# Update node's overall status
manager.update_node_status(Status.RUNNING)

# Update specific flow status
manager.update_flow_status("heatmap_gen", Status.SUCCESS)

Status Enum Options

from node-status-lib.enums import Status

Status.PENDING
Status.RUNNING
Status.SUCCESS
Status.FAILED

🗃️ Database Table Schema

Make sure your PostgreSQL database has a table named node_status. Here's a basic schema:

CREATE TABLE node_status (
    id SERIAL PRIMARY KEY,
    node_id TEXT NOT NULL,
    node_name TEXT NOT NULL,
    flow_name TEXT,
    status TEXT NOT NULL,
    timestamp TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP
);

Requirements

  • Python 3.7+
  • PostgreSQL
  • psycopg2-binary
  • boto3 (optional, for AWS Secrets Manager)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

node_status_lib-0.1.14.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

node_status_lib-0.1.14-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file node_status_lib-0.1.14.tar.gz.

File metadata

  • Download URL: node_status_lib-0.1.14.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.12 Linux/6.8.0-60-generic

File hashes

Hashes for node_status_lib-0.1.14.tar.gz
Algorithm Hash digest
SHA256 c708680f79591be6306193b348bdd3555fa74c8790dffefc05ae5d38fe1ab619
MD5 5a22c06d8f695990f00d0b68d8a40d1e
BLAKE2b-256 7d0a2014430ea27e787c16bd2fdc6fde683aae18bb08b94191f25c898e1ce0b1

See more details on using hashes here.

File details

Details for the file node_status_lib-0.1.14-py3-none-any.whl.

File metadata

  • Download URL: node_status_lib-0.1.14-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.12 Linux/6.8.0-60-generic

File hashes

Hashes for node_status_lib-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 50bee7eaeb1b5b324a0d3c55e72539b7bf843dc251b841aee6b6b960b3a715f0
MD5 1a83cff0270505c6631b6139fca975d3
BLAKE2b-256 f49c870c6dd482086484d1e7cef690c8f7ef087f8c78959b584a95e6401c12e5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page