Skip to main content

Lightweight workflow executor SDK for Python

Project description

Rundown-Workers Python SDK (v0.1.0)

Go Coverage

A highly developer-friendly, lightweight Python SDK for implementing and running workflow workers.

Installation

To install the SDK locally in editable mode (during development):

# From the project root
pip install -e sdk/python

Basic Usage

The SDK uses decorators to register worker functions.

import rundown_workers as rw

# Register a simple task
@rw.queue(name="greetings", max_retries=3)
def hello_task(payload):
    print(f"[*] Received: {payload}")
    return True

if __name__ == "__main__":
    # Start all registered workers in separate polling threads
    rw.run()

Advanced Features

1. Retries with Exponential Backoff

When enqueuing a job or defining a queue, you can specify max_retries. If your function raises an exception, the engine will automatically reschedule the job with an increasing delay (e.g., 5s, 20s, 45s).

2. Local Timeout Enforcement

You can set a timeout (in seconds) for each task. If your function hangs beyond this period, the worker will automatically:

  1. Detect the timeout.
  2. Report the failure to the engine.
  3. Move on to the next available job.
# This task will fail if it takes longer than 2 seconds
rw.enqueue(queue="greetings", payload="Hello!", timeout=2)

Internal Architecture

The Python SDK uses threading to handle local polling for multiple queues simultaneously and to monitor task execution times.

  • Polling Loop: Each queue has its own daemon thread continuously hitting the /poll endpoint.
  • Task Execution: Handlers are executed in a temporary thread with a join(timeout=...) call to ensure the worker process doesn't hang.

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

rundown_workers-0.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

rundown_workers-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file rundown_workers-0.1.0.tar.gz.

File metadata

  • Download URL: rundown_workers-0.1.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for rundown_workers-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6523fa6128c13de85980614849de3739c7027482f4b8524d211b69d2afc97a6a
MD5 f0c369694886a1b0c5250b673933644a
BLAKE2b-256 4b2039c0e5c53b17fc09851c893f94648c4d8812592bdd5b66a704aad2999942

See more details on using hashes here.

File details

Details for the file rundown_workers-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for rundown_workers-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f97fec060dedbaf7c721b5a1aace3a1f86677e4b916bcaec9509f5e8a34b3ee9
MD5 5df769478595278cc732889dd49075d0
BLAKE2b-256 000ecee8628d207118b2c6be0ef2028b3b0d8d2978299d0f5b3337f836557703

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