Skip to main content

futures for remote execution on clusters

Project description

This module provides a Python concurrent.futures executor that lets you run functions on remote systems in your HTCondor or Slurm cluster. Stop worrying about writing job files, scattering/gathering, and serialization—this module does it all for you.

It uses the cloudpickle library to allow (most) closures to be used transparently, so you’re not limited to “pure” functions.

Installation:

pip install clusterfutures

Usage:

import cfut
def square(n):
    return n * n

with cfut.SlurmExecutor() as executor:
    for result in executor.map(square, [5, 7, 11]):
        print(result)

See slurm_example.py and condor_example.py for further examples. The easiest way to get started is to ignore the fact that futures are being used at all and just use the provided map function, which behaves like itertools.imap but transparently distributes your work across the cluster.

Goals & design

clusterfutures is a simple wrapper to run Python functions in batch jobs on an HPC cluster. Each future corresponds to one batch job. The functions that you run through clusterfutures should normally run for at least a few seconds each: running smaller functions will be inefficient because of the overhead of launching jobs and moving data.

Functions, parameters and return values are sent by creating files; this assumes that the control process and the worker nodes have a shared filesystem. This mechanism is convenient for relatively small amounts of data; it’s probably not the best way to transfer large amounts of data to & from workers.

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

clusterfutures-0.4.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

clusterfutures-0.4-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file clusterfutures-0.4.tar.gz.

File metadata

  • Download URL: clusterfutures-0.4.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.6

File hashes

Hashes for clusterfutures-0.4.tar.gz
Algorithm Hash digest
SHA256 5b416fbae6847b2bebfc00e10ff1f2999f58f49e61b90cd7e9e1027ca454f804
MD5 a99327e1889ed98b8371af9f816cf1ce
BLAKE2b-256 8b939ffbd39f624d831cf26a037c4f7a678c5d01cf9eb5e1777e340bd2502be7

See more details on using hashes here.

File details

Details for the file clusterfutures-0.4-py3-none-any.whl.

File metadata

  • Download URL: clusterfutures-0.4-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.6

File hashes

Hashes for clusterfutures-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b46c0569a76f3e66f226b8feecd0d3d91ab1fcdf9a1e26ca3caf3b37db3df485
MD5 a113a41682f802d3087fbeec47e81ae3
BLAKE2b-256 b2679dfc1c2640cef69afeed0c69f6e8f071ba34dad8f416cc191d0d01f6abc9

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