Skip to main content

Parallism made easy (and safe) with futures API

Project description

ezFutures is a Python parallel computation tool that provides the user API similar to that of concurrent futures, with various parallelism backends.

Install

pip install ezFutures

Getting started

First, we need to import the class:

from ezFutures import ezFutures

In order to start working with ezFutures, you must instantiate the class object. The most important parameter to set is the n_procs parameter which defines the number of processes to run in parallel.

ez = ezFutures(n_procs=19)

From there, you can submit jobs in a sequential manner, just as you do with concurrent futures. However, because ezFutures default parallelism backend is not concurrent futures, merely submitting a task will not start the job. You have the option of using concurrent futures process pool as the parallelism backend (we will update documentation in the future to describe this)

def some_task(elem):
    return(elem)

for i in range(10):
    ez.submit(some_task, i)

You can start the jobs by invoking results method, just as you would with the concurrent futures API.

ez.results()

# Progress: |██████████████████████████████████████████████████| 100.0%
# [1, 2, 7, 0, 8, 3, 5, 4, 9, 6]

The 10 tasks submitted are done in parallel asynchronously, which is why the returned results order is jumbled.

In case there are errors, you can retrieve the stacktrace by invoking errors method.

ez.errors()

The default parallelism backend will try the tasks 3 times (configurable using n_retries parameter when initializing ezFutures) before marking the task as a “failed” task.

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

ezFutures-0.0b17.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

ezFutures-0.0b17-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file ezFutures-0.0b17.tar.gz.

File metadata

  • Download URL: ezFutures-0.0b17.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.7

File hashes

Hashes for ezFutures-0.0b17.tar.gz
Algorithm Hash digest
SHA256 f5e9713c9f3c8573a647e2b88383a1dbec49cab397af0ed09e434553ed77feed
MD5 2e2e1818f44df70cae3508ae96404d10
BLAKE2b-256 9bbd7e66e0ef4da3d4e0ec598e5b5511d9708b4fa5263ede429a030ef299c8aa

See more details on using hashes here.

File details

Details for the file ezFutures-0.0b17-py3-none-any.whl.

File metadata

  • Download URL: ezFutures-0.0b17-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.7

File hashes

Hashes for ezFutures-0.0b17-py3-none-any.whl
Algorithm Hash digest
SHA256 de169e43224f2006218af3bc100f29ca689385a3f905d8f160487206f35d613c
MD5 6a418ac45bc2cd06f495ffddb6f6750b
BLAKE2b-256 f9cc5ba95a6160406f8b547c36f28892134b7247c5d66ae622e8bd0d4e9045d2

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