# joblib-progress
A contextmanager to track progress of [`joblib`](https://joblib.readthedocs.io) execution using [`rich.progress`](https://rich.readthedocs.io).
[![joblib-progress](https://asciinema.org/a/Ufe9v8MKfxIzMuvlv2IwCk29l.svg)](https://asciinema.org/a/Ufe9v8MKfxIzMuvlv2IwCk29l)
## 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
```bash
> pip install joblib-progress
```
## Usage
### If you know the number of items
```python
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
```python
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
Raw data
{
"_id": null,
"home_page": "https://github.com/jonghwanhyeon/joblib-progress",
"name": "joblib-progress",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "joblib,progress,rich",
"author": "Jonghwan Hyeon",
"author_email": "jonghwanhyeon93@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/34/d9/456df61ff457e3a4e4754e9fe35b40f374a3529bbe88d94e97d4957d27fa/joblib-progress-1.0.5.tar.gz",
"platform": null,
"description": "# joblib-progress\nA contextmanager to track progress of [`joblib`](https://joblib.readthedocs.io) execution using [`rich.progress`](https://rich.readthedocs.io).\n[![joblib-progress](https://asciinema.org/a/Ufe9v8MKfxIzMuvlv2IwCk29l.svg)](https://asciinema.org/a/Ufe9v8MKfxIzMuvlv2IwCk29l)\n\n## Why\nThe 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`.\n\n## Install\n```bash\n> pip install joblib-progress\n```\n\n## Usage\n### If you know the number of items\n```python\nimport time\n\nfrom joblib import Parallel, delayed\nfrom joblib_progress import joblib_progress\n\n\ndef slow_square(i):\n time.sleep(i / 2)\n return i ** 2\n\nwith joblib_progress(\"Calculating square...\", total=10):\n Parallel(n_jobs=4)(delayed(slow_square)(number) for number in range(10))\n```\n\n### If you don't know the number of items\n```python\nwith joblib_progress(\"Calculating square...\"):\n Parallel(n_jobs=4)(delayed(slow_square)(number) for number in range(10))\n```\n\n# Acknowledgments\nThe idea of using `joblib.parallel.BatchCompletionCallBack` is referenced from https://stackoverflow.com/a/58936697/5133167\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A contextmanager to track progress of joblib execution",
"version": "1.0.5",
"project_urls": {
"Homepage": "https://github.com/jonghwanhyeon/joblib-progress"
},
"split_keywords": [
"joblib",
"progress",
"rich"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1a588ba0d1515a2e1ded4e1e23b676a07e83e391d13c6709884cd65f7ab534fd",
"md5": "6ea5b6f2f993db8c751f58ca99edbfda",
"sha256": "22d78f480c4fc60a0bd90b8ab53f0ceeaa153193a8b769fd8a06ce6e78420ae7"
},
"downloads": -1,
"filename": "joblib_progress-1.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6ea5b6f2f993db8c751f58ca99edbfda",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 3284,
"upload_time": "2024-02-18T07:42:25",
"upload_time_iso_8601": "2024-02-18T07:42:25.425362Z",
"url": "https://files.pythonhosted.org/packages/1a/58/8ba0d1515a2e1ded4e1e23b676a07e83e391d13c6709884cd65f7ab534fd/joblib_progress-1.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "34d9456df61ff457e3a4e4754e9fe35b40f374a3529bbe88d94e97d4957d27fa",
"md5": "6083f22ba53dbe5a941845cbd9692fa9",
"sha256": "42c2ce3174afbc35c87c9d72535bb191b864c7652767513da93391d4669b42f4"
},
"downloads": -1,
"filename": "joblib-progress-1.0.5.tar.gz",
"has_sig": false,
"md5_digest": "6083f22ba53dbe5a941845cbd9692fa9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 3060,
"upload_time": "2024-02-18T07:42:27",
"upload_time_iso_8601": "2024-02-18T07:42:27.265625Z",
"url": "https://files.pythonhosted.org/packages/34/d9/456df61ff457e3a4e4754e9fe35b40f374a3529bbe88d94e97d4957d27fa/joblib-progress-1.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-18 07:42:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jonghwanhyeon",
"github_project": "joblib-progress",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "joblib-progress"
}