bounded-pool


Namebounded-pool JSON
Version 0.0.2 PyPI version JSON
download
home_pagehttps://github.com/michaelkryukov/bounded_pool
SummaryLibrary for running tasks in bounded pool executors.
upload_time2023-08-08 20:00:57
maintainer
docs_urlNone
authorMichael Krukov
requires_python>=3.7
license
keywords library
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # bounded_pool

[![PyPI version](https://badge.fury.io/py/bounded-pool.svg)](https://badge.fury.io/py/bounded-pool)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fmichaelkryukov%2Fbounded_pool.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fmichaelkryukov%2Fbounded_pool?ref=badge_shield)

Simplistic and universal bounded pool executor that allows to process N tasks
as the same time while limiting size of the queue. Tasks can be functions or
coroutines. Under the hood `bounded_pool` uses threads or processes, depending
on used class. Refer to `tests/test_basic.py` for details.

Tasks will only be submited when there are available workers (specified by
`max_workers`). You can specify `max_queue_size` to allow submiting more
tasks than amount of available workers (so workers won't have to wait for
task creation). Refer to `tests/test_queue.py` for details.

Exceptions inside of the tasks craeted with executors are ignored. Refer
to `tests/test_exceptions.py` for details.

## Example / Showcase

```py
import time
from bounded_pool import BoundedThreadPoolExecutor


def test_example():
    futures = []

    with BoundedThreadPoolExecutor() as pool:
        for _ in range(64):
            future = pool.submit(time.sleep, 1)
            futures.append(future)

    assert futures

    for future in futures:
        assert future.done()
        assert future.result() is None
```

## License

[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fmichaelkryukov%2Fbounded_pool.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fmichaelkryukov%2Fbounded_pool?ref=badge_large)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/michaelkryukov/bounded_pool",
    "name": "bounded-pool",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "library",
    "author": "Michael Krukov",
    "author_email": "krukov.michael@ya.ru",
    "download_url": "https://files.pythonhosted.org/packages/39/9f/8b135666d320875baa45874fdbabaf352329c65d6d484c0342bca9119e1c/bounded_pool-0.0.2.tar.gz",
    "platform": null,
    "description": "# bounded_pool\n\n[![PyPI version](https://badge.fury.io/py/bounded-pool.svg)](https://badge.fury.io/py/bounded-pool)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fmichaelkryukov%2Fbounded_pool.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fmichaelkryukov%2Fbounded_pool?ref=badge_shield)\n\nSimplistic and universal bounded pool executor that allows to process N tasks\nas the same time while limiting size of the queue. Tasks can be functions or\ncoroutines. Under the hood `bounded_pool` uses threads or processes, depending\non used class. Refer to `tests/test_basic.py` for details.\n\nTasks will only be submited when there are available workers (specified by\n`max_workers`). You can specify `max_queue_size` to allow submiting more\ntasks than amount of available workers (so workers won't have to wait for\ntask creation). Refer to `tests/test_queue.py` for details.\n\nExceptions inside of the tasks craeted with executors are ignored. Refer\nto `tests/test_exceptions.py` for details.\n\n## Example / Showcase\n\n```py\nimport time\nfrom bounded_pool import BoundedThreadPoolExecutor\n\n\ndef test_example():\n    futures = []\n\n    with BoundedThreadPoolExecutor() as pool:\n        for _ in range(64):\n            future = pool.submit(time.sleep, 1)\n            futures.append(future)\n\n    assert futures\n\n    for future in futures:\n        assert future.done()\n        assert future.result() is None\n```\n\n## License\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fmichaelkryukov%2Fbounded_pool.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fmichaelkryukov%2Fbounded_pool?ref=badge_large)\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Library for running tasks in bounded pool executors.",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://github.com/michaelkryukov/bounded_pool"
    },
    "split_keywords": [
        "library"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "79234f82179cad6268d796b5a8e9939abc8182e64db8fc26f9a4976e5e673031",
                "md5": "4c2ce29989d357cdae12fbf36a911805",
                "sha256": "848aee93afe70c69e320d5d320be30d1dbb26cf85a61f50556ee2e5f655bbb69"
            },
            "downloads": -1,
            "filename": "bounded_pool-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4c2ce29989d357cdae12fbf36a911805",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 3745,
            "upload_time": "2023-08-08T20:00:56",
            "upload_time_iso_8601": "2023-08-08T20:00:56.495038Z",
            "url": "https://files.pythonhosted.org/packages/79/23/4f82179cad6268d796b5a8e9939abc8182e64db8fc26f9a4976e5e673031/bounded_pool-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "399f8b135666d320875baa45874fdbabaf352329c65d6d484c0342bca9119e1c",
                "md5": "09a797bffb357da3e6755bf4f9eb0cc3",
                "sha256": "dff6fd8c9cda225910c3ab123487a8dbb482177a2a473bc12d77835df272e991"
            },
            "downloads": -1,
            "filename": "bounded_pool-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "09a797bffb357da3e6755bf4f9eb0cc3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 4283,
            "upload_time": "2023-08-08T20:00:57",
            "upload_time_iso_8601": "2023-08-08T20:00:57.917216Z",
            "url": "https://files.pythonhosted.org/packages/39/9f/8b135666d320875baa45874fdbabaf352329c65d6d484c0342bca9119e1c/bounded_pool-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-08 20:00:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "michaelkryukov",
    "github_project": "bounded_pool",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "bounded-pool"
}
        
Elapsed time: 0.28042s