Skip to main content

Python pipeline library developed by STYLIGHT.

https://travis-ci.org/stylight/python-paipa.svg?branch=master

Installation

pip install paipa

Quick summary

The lib allows for threaded pipelines as well as so-called co-routine pipelines. The main use-case is limiting peak memory usage when doing complex operations on large-ish (or small-ish) data-sets.

Quick teaser (for more examples, see docs):

>>> pipeline = paipa.Pipeline(
...     (DownloadImage, 4),
...     (StoreDatabase, 1),
... )
>>> pipeline.run()

This example will create 5 threads, 4 for downloading images, one for storing stuff to the database. The outputs of all DownloadImage steps will be forwarded to the one StoreDatabase thread via a Queue.

Thread startup and tear-down is handled by the library and doesn’t concern the programmer at all. All (known) failure cases lead to either a re-spawning of the failed thread or a controlled shutdown of the system. In no case the system should block and do nothing, if it does then it’s definitely a bug and needs to be reported.

Pipeline ingestion can be done via a separate thread or by consuming an iterable. In the case of using an iterable, an ingestion thread is created which consumes the iterable in a controlled manner.

Documentation

Features and non-features

What it does:

  • process stuff concurrently, but one step after another

  • allows class based, iterator based and function based steps

  • can scale steps independent of each other (manually)

  • don’t ever do deadlocks

  • never expose the developer to the concept of a thread (if she doesn’t like to)

  • run in finite batches where all threads are terminated at the end

  • run in continuous mode while being fed through a queue

  • automatically rate limit each step to minimize memory usage

  • terminate the pipeline in case of an Exception and propagate the error to the developer, handling graceful shutdown of all threads involved

What it explicitly doesn’t do (if it doesn’t, it’s not a bug!):

  • pipelines with multiple different parents. Multiple parents of the same type are handled automatically though.

  • auto-scale threads

  • bake bread (haha)

What it shouldn’t do (if it does, it’s a bug!):

  • confuse the user/developer

  • hang on termination

  • hog resources

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paipa-0.3.2.tar.gz (20.4 kB view details)

Uploaded Source

File details

Details for the file paipa-0.3.2.tar.gz.

File metadata

  • Download URL: paipa-0.3.2.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for paipa-0.3.2.tar.gz
Algorithm Hash digest
SHA256 5c672a29ba28d78ab352ddad777104a1bec8ce45220263b365edb6bc43010841
MD5 0edd2fa1412d6b9ce35444fe4bdaf238
BLAKE2b-256 1b8e4e74f00b3488670ba3661eb9f815abff57b96d19fce60fb2eeb8bdd925c5

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.3

1 file

This release

0.3.2 This release

1 file

0.3.1

2 files

0.3.0

1 file

0.2.1

1 file

0.2.0

1 file

0.1.1

1 file

0.1.0

1 file

0.0.2

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page