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.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a41c47baf0775d1efa66d7b02b4fee1c1df39647a81636bb98bdf409e9b91fb1 |
|
MD5 | 3e8073923afc418aa6345b1add498380 |
|
BLAKE2b-256 | 590c9b6d6214ebf446cc59e4ff583482beb024c96f9c9a1991a71093304239c3 |
Close
Hashes for simple_multiprocessing-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3d6b7ad44eaa1e6945a00c8263eab5caf7c6fada4297f81c63f7ba4bbbc6fe7 |
|
MD5 | 3e7fe088d54ae5806d8fe5134858b66d |
|
BLAKE2b-256 | 122cb3c06b831c6711b88938f994f48b0f3956476d02db0151e3be1f3011e777 |