threading-manager


Namethreading-manager JSON
Version 0.0.8 PyPI version JSON
download
home_pagehttps://github.com/centroid457/
Summarymanage spawned threads
upload_time2024-01-14 03:40:48
maintainer
docs_urlNone
authorAndrei Starichenko
requires_python>=3.6
license
keywords threading threads thread thread manager
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # threading_manager (v0.0.8)

## DESCRIPTION_SHORT
Manage spawned threads

## DESCRIPTION_LONG
designed to working with spawned threads


## Features
1. use different managers for different funcs/methods if needed  
2. use just one decorator to spawn threads from func / methods  
3. keep all spawned threads in list by ThreadItem objects  
4. ThreadItem keeps result/exx/is_alive attributes!  
5. use wait_all()  


********************************************************************************
## License
See the [LICENSE](LICENSE) file for license rights and limitations (MIT).


## Release history
See the [HISTORY.md](HISTORY.md) file for release history.


## Installation
```commandline
pip install threading-manager
```


## Import
```python
from threading_manager import *
```


********************************************************************************
## USAGE EXAMPLES
See tests and sourcecode for other examples.

------------------------------
### 1. example1.py
```python
from threading_manager import *

count = 5
time_start = time.time()


# define victim ------------------
class ThreadManager1(ThreadsManager):
    pass


class Cls:
    @ThreadManager1().decorator__to_thread
    def func1(self, num):
        time.sleep(1)
        return num * 1000


# spawn ------------------
for i in range(count):
    assert Cls().func1(i) is None

assert ThreadManager1().count == count
ThreadManager1().wait_all()
assert {item.result for item in ThreadManager1().THREADS} == {num * 1000 for num in range(count)}

ThreadManager1().clear()

# spawn ------------------
for i in range(count):
    assert Cls().func1(i) is None
```

********************************************************************************

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/centroid457/",
    "name": "threading-manager",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "threading,threads,thread,thread manager",
    "author": "Andrei Starichenko",
    "author_email": "centroid@mail.ru",
    "download_url": "https://files.pythonhosted.org/packages/f7/6b/05da342aabd0cb2e8552c3df6eed9c85b30751669910e5558340a4714311/threading_manager-0.0.8.tar.gz",
    "platform": null,
    "description": "# threading_manager (v0.0.8)\r\n\r\n## DESCRIPTION_SHORT\r\nManage spawned threads\r\n\r\n## DESCRIPTION_LONG\r\ndesigned to working with spawned threads\r\n\r\n\r\n## Features\r\n1. use different managers for different funcs/methods if needed  \r\n2. use just one decorator to spawn threads from func / methods  \r\n3. keep all spawned threads in list by ThreadItem objects  \r\n4. ThreadItem keeps result/exx/is_alive attributes!  \r\n5. use wait_all()  \r\n\r\n\r\n********************************************************************************\r\n## License\r\nSee the [LICENSE](LICENSE) file for license rights and limitations (MIT).\r\n\r\n\r\n## Release history\r\nSee the [HISTORY.md](HISTORY.md) file for release history.\r\n\r\n\r\n## Installation\r\n```commandline\r\npip install threading-manager\r\n```\r\n\r\n\r\n## Import\r\n```python\r\nfrom threading_manager import *\r\n```\r\n\r\n\r\n********************************************************************************\r\n## USAGE EXAMPLES\r\nSee tests and sourcecode for other examples.\r\n\r\n------------------------------\r\n### 1. example1.py\r\n```python\r\nfrom threading_manager import *\r\n\r\ncount = 5\r\ntime_start = time.time()\r\n\r\n\r\n# define victim ------------------\r\nclass ThreadManager1(ThreadsManager):\r\n    pass\r\n\r\n\r\nclass Cls:\r\n    @ThreadManager1().decorator__to_thread\r\n    def func1(self, num):\r\n        time.sleep(1)\r\n        return num * 1000\r\n\r\n\r\n# spawn ------------------\r\nfor i in range(count):\r\n    assert Cls().func1(i) is None\r\n\r\nassert ThreadManager1().count == count\r\nThreadManager1().wait_all()\r\nassert {item.result for item in ThreadManager1().THREADS} == {num * 1000 for num in range(count)}\r\n\r\nThreadManager1().clear()\r\n\r\n# spawn ------------------\r\nfor i in range(count):\r\n    assert Cls().func1(i) is None\r\n```\r\n\r\n********************************************************************************\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "manage spawned threads",
    "version": "0.0.8",
    "project_urls": {
        "Homepage": "https://github.com/centroid457/",
        "Source": "https://github.com/centroid457/threading_manager"
    },
    "split_keywords": [
        "threading",
        "threads",
        "thread",
        "thread manager"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "df2ecbafacaba1ce2aa2efe3ab5206c29d31cda459b5df74d64df17996c70155",
                "md5": "0c47f95ba8fbd885d52536dea3d99f7d",
                "sha256": "983345adf8ebf5624233a1123ddc3b17d76fd2ab1bed556da6c822ebc460be71"
            },
            "downloads": -1,
            "filename": "threading_manager-0.0.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0c47f95ba8fbd885d52536dea3d99f7d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 5272,
            "upload_time": "2024-01-14T03:40:47",
            "upload_time_iso_8601": "2024-01-14T03:40:47.684499Z",
            "url": "https://files.pythonhosted.org/packages/df/2e/cbafacaba1ce2aa2efe3ab5206c29d31cda459b5df74d64df17996c70155/threading_manager-0.0.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f76b05da342aabd0cb2e8552c3df6eed9c85b30751669910e5558340a4714311",
                "md5": "b2125d274d797e342d3d670972493d12",
                "sha256": "8fa9ad2491b97a28b23193f116f3ab7bd3628ec60511a0ad051a33b5a62919ff"
            },
            "downloads": -1,
            "filename": "threading_manager-0.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "b2125d274d797e342d3d670972493d12",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 5008,
            "upload_time": "2024-01-14T03:40:48",
            "upload_time_iso_8601": "2024-01-14T03:40:48.962325Z",
            "url": "https://files.pythonhosted.org/packages/f7/6b/05da342aabd0cb2e8552c3df6eed9c85b30751669910e5558340a4714311/threading_manager-0.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-14 03:40:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "centroid457",
    "github_project": "threading_manager",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "threading-manager"
}
        
Elapsed time: 0.20142s