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.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 395617b3b74e4c69502fdebd03c7b46343f8e3422aaddc5d7cafae8fde16173b |
|
MD5 | ea73c6225edc98540cd6ae5ec6c4269a |
|
BLAKE2b-256 | 1d7d820a3df25448c74dd1c883e5e4e3b1185d571495a65b5881129f57a0ab47 |
Close
Hashes for simple_multiprocessing-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e8afc274a8e169339c70aef24303be545c3bc4de82b48abe3f028d6d313f72d |
|
MD5 | 62daa450e9e3098774b1e9d3b9e03d19 |
|
BLAKE2b-256 | 0752e6f969e1c6baca4d1f9ea56dcd467c33f3ab42a7006a2ec8e6db19a1c42a |