# 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": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "joblib, progress, rich",
"author": "Jonghwan Hyeon",
"author_email": "jonghwanhyeon93@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/f5/65/d6a5a6b322ffd4319bb39f22b0c0d71ad89233843764c6f1afc0c4b3b7aa/joblib_progress-1.0.6.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.6",
"project_urls": {
"Homepage": "https://github.com/jonghwanhyeon/joblib-progress"
},
"split_keywords": [
"joblib",
" progress",
" rich"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cce4d71e71edc972d534f51cff72fa30edb8b0e5df109b2e5ae67a3985faebb9",
"md5": "c8dcf54863d35947f39eb3d93a8f0549",
"sha256": "fbd26706cb7fabf8c953dc5ca221ab3daa7e1daff6395e61655244e667bfa5a2"
},
"downloads": -1,
"filename": "joblib_progress-1.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c8dcf54863d35947f39eb3d93a8f0549",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 3483,
"upload_time": "2024-11-07T13:12:52",
"upload_time_iso_8601": "2024-11-07T13:12:52.188628Z",
"url": "https://files.pythonhosted.org/packages/cc/e4/d71e71edc972d534f51cff72fa30edb8b0e5df109b2e5ae67a3985faebb9/joblib_progress-1.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f565d6a5a6b322ffd4319bb39f22b0c0d71ad89233843764c6f1afc0c4b3b7aa",
"md5": "7eb34779830fab44744cc4e4e4c6001b",
"sha256": "9b4d97f0ab0fc439be29e8d6ed3114b0a3140f60d709e8a6a6ed3633767e48bc"
},
"downloads": -1,
"filename": "joblib_progress-1.0.6.tar.gz",
"has_sig": false,
"md5_digest": "7eb34779830fab44744cc4e4e4c6001b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 3119,
"upload_time": "2024-11-07T13:12:53",
"upload_time_iso_8601": "2024-11-07T13:12:53.455340Z",
"url": "https://files.pythonhosted.org/packages/f5/65/d6a5a6b322ffd4319bb39f22b0c0d71ad89233843764c6f1afc0c4b3b7aa/joblib_progress-1.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-07 13:12:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jonghwanhyeon",
"github_project": "joblib-progress",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "joblib",
"specs": []
},
{
"name": "rich",
"specs": []
}
],
"lcname": "joblib-progress"
}