Skip to main content

execute multiple async tasks as simple as possible

Project description

simple_multiprocessing

python_version PyPI downloads/month

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_multiprocessing-0.0.3.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

simple_multiprocessing-0.0.3-py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page