Skip to main content

run_parallel

Pass an array or generator of callables and run_parallel will run them as fast as possible.

Lambdas are not supported yet.

Example

As computations are often a little bit complex, classes make sense often. Override the __call__ method:

class ExensiveComputation:

    def __init__(self, arg):
        self.arg = arg

    def __call__(self):
        res = self._step1(self.arg)
        res = self._step2(res)
        return res

    def _step1(self, arg):
        # expensive stuff here
        return res

    def _step2(self, arg):
        # expensive stuff here
        return res


computations = [ExensiveComputation(1), ExensiveComputation(2), ExensiveComputation(3)]
res1, res2, res3 = run_parallel(computations)

Metadata

Release files for run-parallel 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for run-parallel 0.0.6
File Size Uploaded
run_parallel-0.0.6.tar.gz 7.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for run-parallel 0.0.6
File Interpreter ABI Platform
run_parallel-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 14.5 kB

Release files / run_parallel-0.0.6.tar.gz

Download URL run_parallel-0.0.6.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
330d7e03b4840a4012cbac060fb461bcca7d0c6bc0e2d0880f3eb52a0258e7b4
BLAKE2b-256 checksum
How to use checksums
a369caa8d8470ad1107f1fe19d3ffa1b016c4e5ce35945d79617face5c76d286
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

Release files / run_parallel-0.0.6-py3-none-any.whl

Download URL run_parallel-0.0.6-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d2d266c0269fac3fc402f72981ee1eaf18d6c86535d30d515e052cc8db2b63a0
BLAKE2b-256 checksum
How to use checksums
b2ffd3ea03c11d775056358b7127732baa20eb0fcd4a6e70d261c4649e7be74b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page