Skip to main content

A lightweight Python task orchestration library for executing dependency-based workflows using a synchronous DAG executor

Project description

Pravaha (a sanskrit word which means flow) is a Python library for defining and executing dependency-aware workflows, allowing developers to automate complex workflows declaratively using Python decorators.

Features

  • Define tasks using the @Task decorator

  • Automatic execution order based on task dependencies

  • Built-in logging and execution context for task outputs

  • Task states tracking: PENDING, SUCCESS, FAILED, SKIPPED

  • Fail-fast error handling for dependent tasks

  • Lightweight and extensible for workflow automation

  • Conditional Task Execution on the basis of environment variables, previous task output and success failure of previous task.

  • Retry Policy

  • Task Output Sharing

  • Priority Based Task Execution

  • Tagging of tasks

  • Task Group Execution

  • HTML Report Generation

How It Works

You define functions as tasks using the @Task decorator. The engine automatically:

  1. Resolves task dependencies and enforces execution order

  2. Passes outputs from one task to dependent tasks

  3. Tracks execution states (SUCCESS, FAILED, SKIPPED)

  4. Handles errors and optionally retries failed tasks (planned feature)

Example

from pravaha.core.task import Task
from pravaha.core.executor import TaskExecutor

@Task(name="fetch_data")
def fetch_data():
    """Fetch initial data."""
    return 42

@Task(name="process_data", depends_on=["fetch_data"])
def process_data(data):
    """Process data returned by fetch_data."""
    return data * 2

@Task(name="print_result", depends_on=["process_data"])
def print_result(result):
    """Print the final result."""
    print(f"Final Result: {result}")

# Execute all tasks in the correct order
TaskExecutor.execute()

Expected Output

Final Result: 84

Local Setup

Since the library is not yet published, you can set it up locally:

  1. Clone the repository:

    git clone <repository-url>
    cd task-orchestrator
  2. Install development dependencies:

    pip install -e .[dev]

Running Tests

The library includes unit tests for all core components:

  • Task decorator

  • Registry

  • Executor logic

Run the tests:

pytest

Notes:

  • Tests reset global state to avoid cross-test contamination

  • DAG validation and dependency execution are fully covered

  • CI/CD workflows can run tests automatically on every commit

Contributing

Contributions are welcome! Please follow these guidelines:

  • Follow existing code style and naming conventions

  • Add unit tests for new features or bug fixes

  • Keep commits focused and descriptive (use conventional commits)

  • Ensure tests pass before submitting a pull request

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

pravaha-1.0.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

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

pravaha-1.0.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file pravaha-1.0.0.tar.gz.

File metadata

  • Download URL: pravaha-1.0.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.0

File hashes

Hashes for pravaha-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4b1e709cbca2203778075fa02b6b5850e7685e5b741221e1b388aa163a92078d
MD5 b59ac431c8e5d3fc2108363cca96623d
BLAKE2b-256 5172feb5560965d8bd123e49fee6a8c3c813ff1a11cd74548017e9752633439c

See more details on using hashes here.

File details

Details for the file pravaha-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pravaha-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.0

File hashes

Hashes for pravaha-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83a9c962ab90a88e57fec88b361e00ef90d037d1e97fc85d4d66fa1d66ab890a
MD5 4150b3c753cde4aeaccfac02f03e5c23
BLAKE2b-256 02ed21cc880f8ffa09fa1b554071fa9d816d509e87e358e5218fd199b9dc9c52

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