A collection of patterns to use over top of the built in multiprocessing package
Project description
mp_boilerplate
A collection of patterns to use over top of the built in multiprocessing package.
Install
pip install mp_boilerplate
Use Case: (E)xtract (P)arallel (T)ransform (S)ave
The extract parallel transform save (EPTS) use case is as follows:
- A producer(single)/consumer(multiple) that applies a transform
- A producer(multiple)/consumer(single) that saves the transform
This usually means: read a file/folder, do something to each item, save the result.
import mp_boilerplate as mpb
import typing as t
from typeguard import typechecked
def extract() -> t.Iterator:
for i in range(100):
yield i
def transform(i):
return i + 1
def save(items: t.Iterator):
for item in items:
print(item)
if __name__ == '__main__':
worker = mpb.EPTS(extract, transform, save)
worker.start()
worker.join()
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
mp_boilerplate-0.3.3.tar.gz
(3.9 kB
view details)
Built Distribution
File details
Details for the file mp_boilerplate-0.3.3.tar.gz
.
File metadata
- Download URL: mp_boilerplate-0.3.3.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7284706fbbfe237ff919937f47db1f1fb11b1c30dbe12927f37a442f07c6d2b7 |
|
MD5 | 733eb12cf240fbd24f37072d0280547d |
|
BLAKE2b-256 | 7d669c4313bfc5f3d9a489805a8df32472d17a583baffa36cc73743c434c9402 |
Provenance
File details
Details for the file mp_boilerplate-0.3.3-py3-none-any.whl
.
File metadata
- Download URL: mp_boilerplate-0.3.3-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fe5c4afa2ee673f2d65407388589c4c7daaafd2ee716ae42e0d538c0ec9529b |
|
MD5 | 2ad006f74c1e736eaa83f5f0a3133569 |
|
BLAKE2b-256 | ed16719da3ffaa59ccc21ed95c37f103d1c5c9e91c056a5086aaf4bbe4f650c6 |