A DAG framework written in std python
Project description
Effortless Task Management: Flexible, Fast, Simple and Reliable
Overview
Taskade is a Python framework designed to simplify the execution of tasks with dependencies. It provides a flexible and efficient way to manage task execution, allowing developers to focus on writing task logic rather than managing dependencies.
Features
- High Performance: Optimized for speed and efficiency.
- Easy to Use: Simple and intuitive API.
- Lightweight: Taskade has no dependencies on anything outside of the standard library.
- Flexible Execution: Choose from various execution strategies, including sequential, concurrent, and asynchronous execution.
- CGraphLib: An optional dependency written for Taskade cgraphlib. With up to a ~2.5x performance improvement over the standard library.
Design Principles
Taskade is designed with the following principles in mind:
- Separation of Concerns: Task logic is separate from execution logic.
- Flexibility: Support for various execution strategies and task types.
- Efficiency: Optimize task execution for performance.
Use Cases
Taskade is suitable for applications that require:
- Complex Task Dependencies: Manage complex task dependencies with ease.
- High-Performance Execution: Execute tasks concurrently for improved performance.
- Asynchronous Tasks: Support for asynchronous tasks and execution.
Getting Started
Install Taskade
pip install taskade
cgraphlib
cgraphlib is a C extension that provides a more performant graph traversal algorithm and is also available on versions of python that don't support the graphlib providing a ~2.5x performance improvement
Basic Usage
To create a Task, the simplest way is through the @task
decorator:
from taskade import task
@task(graph_name='my_graph')
def my_task():
# Task implementation
return "example_output"
@task(graph_name='my_graph', dependencies=my_task)
def my_second_task():
# Task implementation
return "example_output"
@task(graph_name='my_graph')
def my_third_task():
# Task implementation
return "example_output"
@task(graph_name="my_graph", dependencies=(my_second_task, my_third_task))
def my_final_task(dependent_result)
print(dependent_result)
return "final_example_output"
Using the decorator automatically creates a Graph and allows it to be executed.
from taskade import get_graph
def main():
results = get_graph("my_graph")() # Call the execution of the graph
print(results[my_task]) # Prints `example_output`
print(results[my_final_task]) # Prints `final_example_output`
if __name__ == "__main__":
main()
Combine Sync & Async Tasks
Taskade graphs also allow for mixing async and sync tasks within the same graph. Blocking will occur only when an sync function is executing, but otherwise the same async behavior will be preserved.
from taskade import task
@task(graph_name='my_graph')
async def my_task():
# Task implementation
return "example_output"
@task(graph_name="my_graph", dependencies=my_task)
def my_final_task(dependent_result)
print(dependent_result)
you will still need to execute the graph using await
as some of the nodes are async.
from taskade import get_graph
import asyncio
async def main():
results = await get_graph("my_graph")() # Call the execution of the graph
print(results[my_task]) # Prints `example_output`
print(results[my_final_task]) # Prints `final_example_output`
if __name__ == "__main__":
asyncio.run(main())
Documentation
The above are just the basics of using Taskade, there is a lot more functionality provdided that can be found in the documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file taskade-0.0.1.tar.gz
.
File metadata
- Download URL: taskade-0.0.1.tar.gz
- Upload date:
- Size: 19.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4d06a04821dd7d7ebb7bf8f25ac5940d0004c0d4590fc0e6d2423e44cdec034 |
|
MD5 | 603b6268c53502a688a926229c20cf8b |
|
BLAKE2b-256 | bad64bf20317c0a062453fffb63cd14974909bc6d90d550fc523e991437143f1 |
File details
Details for the file taskade-0.0.1-cp311-cp311-manylinux_2_35_x86_64.whl
.
File metadata
- Download URL: taskade-0.0.1-cp311-cp311-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 39.0 kB
- Tags: CPython 3.11, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f883ccd97e58bc7d0cd2c949d0b8a332d85d2975835c7b0886227c425e68bdff |
|
MD5 | edca1ec5e9b84b65148364131f2d990c |
|
BLAKE2b-256 | eef63ebcf895a157023bc37dae95be09a4c16e3f296d486ffcc04b0997791065 |
File details
Details for the file taskade-0.0.1-cp310-cp310-manylinux_2_35_x86_64.whl
.
File metadata
- Download URL: taskade-0.0.1-cp310-cp310-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 38.2 kB
- Tags: CPython 3.10, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 515f224bcacf8fb5463a4af068ac664b68e00d49172df14e84be112ade931543 |
|
MD5 | 57aa99e5aa39248a31a8de1153949649 |
|
BLAKE2b-256 | d1887be55fe99734828f5d0e9d9e473b501668f25a40c7739dac3423711afe87 |
File details
Details for the file taskade-0.0.1-cp39-cp39-manylinux_2_35_x86_64.whl
.
File metadata
- Download URL: taskade-0.0.1-cp39-cp39-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 38.0 kB
- Tags: CPython 3.9, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eed721a97fb80372f468e73d06e75bb79080a17648e0d0c2a9b443a884f0319d |
|
MD5 | 8c01cced9cea37c39f31546a2e8cca38 |
|
BLAKE2b-256 | fae5fd29fad6d437166cfac84899014bcc920822fc6a523e9935767e6f85c9a5 |
File details
Details for the file taskade-0.0.1-cp38-cp38-manylinux_2_35_x86_64.whl
.
File metadata
- Download URL: taskade-0.0.1-cp38-cp38-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 38.8 kB
- Tags: CPython 3.8, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d15484b73f2c73102cd6ec98ae2b4665f6bf56c05d16a257ca073919b0ac92b8 |
|
MD5 | b97a31a9d33b5475042f45229679d7cb |
|
BLAKE2b-256 | f5bd6ac142e5d2ef89b9b2ef821b127d26477a73ff983dcdf2077d9dc4e63017 |