execute multiple async tasks as simple as possible
Project description
simple_multiprocessing
Description
execute multiple async tasks as simple as possible
Install
pip install simple_multiprocessing
# or
pip3 install simple_multiprocessing
Usage
from simple_multiprocessing import MultiProcess, Task
import random, time
def test(i: int) -> float:
print('started:', i)
start = time.time()
if random.random() < 0.5:
while True:
time.sleep(0.01)
return time.time() - start
tasks = [Task(test, i) for i in range(5)]
results = MultiProcess(tasks).solve(timeout=1)
[print(i, type(r), r) for i, r in enumerate(results)]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for simple_multiprocessing-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c99f5e67f1771a059b0c8b3df40959c9f0f1506c52f22bfc7c050b24bb7a3848 |
|
MD5 | 8e8f892aa453654f315e74a5e2d765de |
|
BLAKE2b-256 | 2818126ec9b7446c302f33ec463c3a826d9275eedf3a0c9df874cb854ae613f1 |
Close
Hashes for simple_multiprocessing-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 395247ca57c9296412065bbc35288ccd8dd8c7e21eb2cf6b53835529f5f93692 |
|
MD5 | 88788ddb6e2a8e07584d04452a17f15d |
|
BLAKE2b-256 | a2ea11619fa03169749fbdf775002d5cd9dd89786b08a27b9007aaa30d821d56 |