MultiTASKLite: A lightweight library for Python multitasking
The mtasklite library provides enjoyable parallelization of iterating through an iterable with or without a progress bar. It 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, 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.
Supporting object-based workers enables:
- Using different GPUs, models, or network connections in different workers.
- 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.
- 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.
Metadata
Release files for mtasklite 0.3.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 | |
|---|---|---|---|
| mtasklite-0.3.5.tar.gz | 20.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mtasklite-0.3.5-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 42.1 kB
Release files / mtasklite-0.3.5.tar.gz
| Download URL | mtasklite-0.3.5.tar.gz |
|---|---|
| Size | 20.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
48d23e70a3f4e0956ac1afc3191e557b12f83cbe9e8c7a9b505f05f1b40f093d
|
|
BLAKE2b-256 checksum How to use checksums |
237857d27e5dc79051074d691e47efeb48d602a7ea8034915db098cc21f9122e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.23
|
Release files / mtasklite-0.3.5-py2.py3-none-any.whl
| Download URL | mtasklite-0.3.5-py2.py3-none-any.whl |
|---|---|
| Size | 21.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
0fcc7aae03c8a6969ef21d8fa1cb753a1731a7a1411e58b484dcd6a8b22bc360
|
|
BLAKE2b-256 checksum How to use checksums |
86214fefa2872eda4b63349f8673bea564cbe67914239f066208eecde7a15bc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.23
|