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.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5df38df6c251e484e48560e4feed8d6e1e5faeb283ea9729db962e86d7b91240 |
|
MD5 | 907a9a6caa4c009f949a97f94d1c1bfc |
|
BLAKE2b-256 | f093d88b3ea9e2197876f4854983b68f1065359d8b95d21776a284ff5e2431b3 |
Close
Hashes for simple_multiprocessing-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78f80987eab56db8566c0b6c9d780e60ffda84aa0f628b41609cbc4837fc4d4e |
|
MD5 | 76929f49594cd58c612c1fa13b38c8c0 |
|
BLAKE2b-256 | 36afdf7ce350e0356e0637430d3ff2fea6e15727c003e9b4bac5bcef16c380b1 |