Skip to main content

An pqdm-compatible (almost) extension that supports stateful worker pools with both sized and unsized iterables.

Project description

PyPI version Downloads Downloads

MultiTASKLite: A lightweight library for Python multitasking

This mtasklite library is inspired by the simplicity of the great pqdm library, but it improves upon pqdm in several ways, in particular, by supporting object-based (stateful) workers, truly "lazy" iteration (see a detailed list of features), and context managers (i.e., a support for with-statement). Stateful workers are implemented using the cool concept of delayed initialization, which is effortlessly enabled by adding @delayed_init decorator to a worker class definition.

This enables:

  1. Using different GPUs, models, or network connections in different workers.
  2. Efficient initialization of workers: If the worker needs to load a model (which often takes quite a bit of time), it will be done once (per process/thread) before processing input items.(examples/mtasklite_pqdm_spacy_tokenization_demo.ipynb) for an example.
  3. Logging and bookkeeping: Each worker is represented by an object that "lives" as long as we have items to process (data can be stored in the object attributes).

The mtasklite package provides pqdm-compatibility wrappers, which can be used as a (nearly) drop-in replacement of pqdm. For an overview of differences, and a list of features, please, refer to the documentation in the GitHub repository.

This library is replacing py_stateful_map. The objective of this replacement to provide a more convenient and user-friendly interface as well as to fix several issues.

Credits

A huge shoutout to the creators for the multiprocess library, which is a drop-in replacement of the standard Python multiprocessing library, which resolves various pickling issues that arise on non-Unix platforms (when a standard multiprocessing library is used). Thanks to their effort, mtasklite works across Linux, Windows, and MacOS.

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

mtasklite-0.3.1.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

mtasklite-0.3.1-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file mtasklite-0.3.1.tar.gz.

File metadata

  • Download URL: mtasklite-0.3.1.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for mtasklite-0.3.1.tar.gz
Algorithm Hash digest
SHA256 b0e0563b0e16ab0fca72dc92d6cb4827415d2b21f65c417cef2465497b0f36a9
MD5 9566bb5d2d96e20265323827f1c876d6
BLAKE2b-256 a3d0004a4cccfe60d5b0cd0492591846b289a1ac487cca21392ec4d2f4c39fff

See more details on using hashes here.

File details

Details for the file mtasklite-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: mtasklite-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for mtasklite-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2de93f884c0642c1341265b13f28ee5347d26cb45119911e9f6041dd1e47f041
MD5 c7d683ef6ceb181bfdd0782a60a3f3e1
BLAKE2b-256 d6f610444dc7b07ae5d6065dab6d1ca3dec2eb9b19990ea75303066b5c06c9cd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page