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.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ec2d94fc191fe0a9e96030c278ed8662e66c778109b7aeb764c17dde2102abe |
|
MD5 | cdda98b554931019575bfd71699d9bb4 |
|
BLAKE2b-256 | c6f1597b5f2cbc70f399dec69084cb0b922784d6f8f8011697b49eb2689130a2 |
Close
Hashes for simple_multiprocessing-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c85656a0e1a690c56020155b18988e3dd3068f9af15740e5d713ae4afb258379 |
|
MD5 | 2198723fc448a75614e5946571681653 |
|
BLAKE2b-256 | 077df92b359f236523818b27f41728c89f38414ed51a668b143873da40dc0763 |