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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e416986e90af218770af1b44dd10a5899f091754a7c58f3ae22b92f5be517930 |
|
MD5 | 51ca0bd22c9d763db1cfb9da9befe9c0 |
|
BLAKE2b-256 | 12c4041c01ca1e840b8ee1f65de41215e5aa2bad47e0d80bd2d4a038eb38f44f |
Close
Hashes for simple_multiprocessing-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af9f74ff158e5ba74a99914584005fe19485a379d7e9c3f28d436fad998c0313 |
|
MD5 | eb0214f9d39a6cd607ac16de65b52fd8 |
|
BLAKE2b-256 | d8e2d4f7401399573b8e53bf20a4ae214cffddf2ae03dc474ffd3af2819b4382 |