A pipeline system for efficient execution.
Project description
Pyturbo Package
Author: Lijun Yu
Email: lijun@lj-y.com
A pipeline system for efficient execution.
Installation
pip install py-turbo
Introduction
Pyturbo
utilizes multiple level of abstract to efficiently execute parallel tasks.
- Worker: a process.
- Stage: a group of peer workers processing the same type of tasks.
- Task: a data unit transferred between stages. At each stage, a task is processed by one worker and will result in one or multiple downstream tasks.
- Pipeline: a set of sequential stages.
- Job: a data unit for a pipeline, typically a wrapped task for the first stage.
- Result: output of a job processed by one pipeline, typically a set of output tasks from the last stage.
- System: a set of peer pipelines processing the same type of jobs.
Get Started
from pyturbo import ReorderStage, Stage, System
class Stage1(Stage): # Define a stage
def allocate_resource(self, resources, ...):
... # Optional: split resources and determine number of workers.
def process(self, task):
... # Process function for each worker process. Returns one or a series of downstream tasks.
... # Repeat for Stage2, Stage3
class Stage4(ReorderStage): # Define a reorder stage, typically for the final stage
def get_sequence_id(self, task):
... # Return the order of each task. Start from 0.
def process(self, task):
...
class MySystem(System):
def get_stages(self, resources):
... # Define the stages in a pipeline with given resources.
def get_results(self, results_gen):
... # Define how to extract final results from output tasks.
def main():
system = MySystem(num_pipeline) # Set debug=True to run in a single process
system.start() # Build and start system
jobs = [...]
system.add_jobs(jobs) # Submit jobs
for job in system.wait_jobs(len(jobs)):
print(job.results) # Process result
system.end() # End system
Options
See options.md
Demo
See demo.py for an example implementation.
Version History
See version.md.
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
py-turbo-0.7.0.tar.gz
(22.7 kB
view details)
Built Distribution
py_turbo-0.7.0-py3-none-any.whl
(25.5 kB
view details)
File details
Details for the file py-turbo-0.7.0.tar.gz
.
File metadata
- Download URL: py-turbo-0.7.0.tar.gz
- Upload date:
- Size: 22.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0754171c638979b6fdf5be7bee157431cafb2465bea5bf4671986856b7336527 |
|
MD5 | 06537edd5f37aefceb64115fe573322f |
|
BLAKE2b-256 | 1ad13b3886d86f701e86de78516f39cb748037debd17ac1cceb7a33f70d7902d |
File details
Details for the file py_turbo-0.7.0-py3-none-any.whl
.
File metadata
- Download URL: py_turbo-0.7.0-py3-none-any.whl
- Upload date:
- Size: 25.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb2f6125c1ea82f9a65cdeaf91e9531a941c8c77783e678c27f40abb05c754d8 |
|
MD5 | 5ec3064625e4473d46107594e6e0acaf |
|
BLAKE2b-256 | 79935f6185182cd0760d86b055ce1629046e05ae53e14805cee2a5cf42e190ce |