A contextmanager to track progress of joblib execution
Project description
joblib-progress
A contextmanager to track progress of joblib
execution using rich.progress
.
Why
The vanilla multiprocessing
does not work when an object to multiprocess is not pickle-able
. The joblib
solves this, but then its progress is not tracked nicely. This library solves that tracking issue with joblib
.
Install
> pip install joblib-progress
Usage
If you know the number of items
import time
from joblib import Parallel, delayed
from joblib_progress import joblib_progress
def slow_square(i):
time.sleep(i / 2)
return i ** 2
with joblib_progress("Calculating square...", total=10):
Parallel(n_jobs=4)(delayed(slow_square)(number) for number in range(10))
If you don't know the number of items
with joblib_progress("Calculating square..."):
Parallel(n_jobs=4)(delayed(slow_square)(number) for number in range(10))
Acknowledgments
The idea of using joblib.parallel.BatchCompletionCallBack
is referenced from https://stackoverflow.com/a/58936697/5133167
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
joblib-progress-1.0.5.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for joblib_progress-1.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22d78f480c4fc60a0bd90b8ab53f0ceeaa153193a8b769fd8a06ce6e78420ae7 |
|
MD5 | 6ea5b6f2f993db8c751f58ca99edbfda |
|
BLAKE2b-256 | 1a588ba0d1515a2e1ded4e1e23b676a07e83e391d13c6709884cd65f7ab534fd |