Python DAG Runner
Python DAG Runner is a Python library for running Directed Acyclic Graphs (DAGs) efficiently. It provides a simple and intuitive interface for defining and executing complex workflows. It uses networkx library to generate directed acyclic graph from the tasks and it's dependencies.
Installation
You can install python-dag-runner library easily using pip:
pip install python-dag-runner
Usage
You can easily define a dag in python-dag-runner using Dag class. Furthermore, task can be defined using Task class. You can easily define dependencies of tasks using the "|=" operator.
from python_dag_runner import Dag, Task
# Create an executable function
def print_task_1():
"""A sample function"""
print("Task 1 called")
def print_task_1():
"""A sample function"""
print("Task 2 called")
# Create Task objects
task_1 = Task(name="task one", executable=print_task_1)
task_2 = Task(name="task two", executable=print_task_2)
# Set dependencies of task using bitwise or operator
task_2 |= {task_1}
# Create a DAG by providing name and sequence of tasks
dag = Dag("My first DAG", tasks=[task_1, task_2])
# Initiate execution of Dag using initialize method
dag.initiate()
Example of complex dependencies
Multiple internal dependencies can be defined using dependency operator.
task_2 |= {task_1}
task_3 |= {task_2}
task_4 |= {task_2}
task_5 |= {task_2}
task_6 |= {task_3, task_4, task_5}
task_7 |= {task_6}
task_8 |= {task_7}
task_9 |= {task_7}
The above steps result in the dependency graph as shown below
%%{init: {'theme': 'neutral'}}%%
stateDiagram
direction LR
task_one --> task_two
task_two --> task_three
task_two --> task_four
task_two --> task_five
task_three --> task_six
task_four --> task_six
task_five --> task_six
task_six --> task_seven
task_seven --> task_eight
task_seven --> task_nine
Metadata
Release files for python-dag-runner 0.0.5
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 |
|---|---|---|---|---|
| python-dag-runner-0.0.5.tar.gz | 5.5 kB | Without provenance | Details for python-dag-runner-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_dag_runner-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for python_dag_runner-0.0.5-py3-none-any.whl |
Total release size: 12.3 kB
Release files / python-dag-runner-0.0.5.tar.gz
| Download URL | python-dag-runner-0.0.5.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c1b8a873a39dcc419bebc8ac891572bf27487adb859c60b9315c4b7109b4ad6c
|
|
BLAKE2b-256 checksum How to use checksums |
90169959d91a36a7e8e48795b1465939c306dfe5cac1bb36f01d038d2c511f52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Release files / python_dag_runner-0.0.5-py3-none-any.whl
| Download URL | python_dag_runner-0.0.5-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
07ca58d732ec2f6c36f8fc8a16d80c58a9b92d4054b2ae390837c9ce960a486b
|
|
BLAKE2b-256 checksum How to use checksums |
465092252d061a1c49b9d9c01d3f18631e7b860f4e3aa48102576c38ab8e121f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Security for python-dag-runner 0.0.5
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.