Skip to main content

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.

Release files for clusterfutures 0.5

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

Source distribution (sdist)

Source distribution for clusterfutures 0.5
File Size Uploaded
clusterfutures-0.5.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clusterfutures 0.5
File Interpreter ABI Platform
clusterfutures-0.5-py3-none-any.whl Python 3 none any Details

Total release size: 18.7 kB

Release files / clusterfutures-0.5.tar.gz

Download URL clusterfutures-0.5.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
261e82c44b500e39b71e3a2c41db66d9777e9674d58449cb90aa83a1955e9453
BLAKE2b-256 checksum
How to use checksums
9105667b80f05dfb2b175f8d36f3c737e5ae9cb6e65f0c0a2cea0d655d73c2c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / clusterfutures-0.5-py3-none-any.whl

Download URL clusterfutures-0.5-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
391c9258da445366b7e859ac8ed2883aecfd26de364959fc1910e1a7c63bb933
BLAKE2b-256 checksum
How to use checksums
8a0cb3357f3f7fe40009f24c2aac4ad6ae902071c5eff340c162f4c895751a20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release history Release notifications | RSS feed

This release

0.5 This release

2 release files

0.4

2 release files

0.3

1 release file

0.2

1 release file

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