Skip to main content

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

Project description

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)

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

run_parallel-0.0.6.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

run_parallel-0.0.6-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file run_parallel-0.0.6.tar.gz.

File metadata

  • Download URL: run_parallel-0.0.6.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for run_parallel-0.0.6.tar.gz
Algorithm Hash digest
SHA256 330d7e03b4840a4012cbac060fb461bcca7d0c6bc0e2d0880f3eb52a0258e7b4
MD5 488b334e543ee402d0eca6cc4e53068e
BLAKE2b-256 a369caa8d8470ad1107f1fe19d3ffa1b016c4e5ce35945d79617face5c76d286

See more details on using hashes here.

File details

Details for the file run_parallel-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: run_parallel-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for run_parallel-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d2d266c0269fac3fc402f72981ee1eaf18d6c86535d30d515e052cc8db2b63a0
MD5 948019fea758e8c0c90cdeedb9c0ed4a
BLAKE2b-256 b2ffd3ea03c11d775056358b7127732baa20eb0fcd4a6e70d261c4649e7be74b

See more details on using hashes here.

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