Registry / data / dask-jobqueue

dask-jobqueue

JSON →
library0.9.0pypypi✓ verified 89d ago

Dask-Jobqueue simplifies the deployment of Dask distributed clusters on traditional high-performance computing (HPC) job queuing systems such as PBS, Slurm, LSF, SGE, MOAB, OAR, and HTCondor. It allows users to dynamically launch Dask workers as jobs on a cluster, integrating Dask's parallel computing capabilities with existing HPC infrastructure. The library is actively maintained, with the current version being 0.9.0, and typically follows a regular release cadence aligned with Dask's ecosystem updates. [1, 5, 15, 16]

pip install dask-jobqueue
INSTALL
IMPORT
SIG · DASK-JOBQUEUE
D
dask-jobqueue
datapythonv0.9.0
Install
5.1s avg
Import
1680ms
Disk
54MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.9.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.915 runs
installs and imports cleanly · install 0.0s · import 1.725s · 51.6MB
glibc
py 3.10–3.915 runs
installs and imports cleanly · install 5.1s · import 1.635s · 53MB
54MB installed
● package 54MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PBSCluster
✓ from dask_jobqueue import PBSCluster
SLURMCluster
✓ from dask_jobqueue import SLURMCluster
SGECluster
✓ from dask_jobqueue import SGECluster
LSFCluster
✓ from dask_jobqueue import LSFCluster
HTCondorCluster
✓ from dask_jobqueue import HTCondorCluster
OARCluster
✓ from dask_jobqueue import OARCluster
MoabCluster
✓ from dask_jobqueue import MoabCluster
Client
✓ from distributed import Client

This quickstart demonstrates how to create a Dask SLURMCluster, scale it, connect a Dask client, perform a simple distributed computation, and then shut down the cluster. Users should customize the `cluster_kwargs` dictionary with values appropriate for their specific HPC environment and job scheduler. [4, 9, 10, 16]

import os from dask_jobqueue import SLURMCluster from distributed import Client import dask.array as da # NOTE: Configure these parameters for your specific HPC system # Use os.environ.get for security if this were a production setup # Here, hardcoding for quickstart simplicity, but in real scenarios # these would come from config files or environment variables. cluster_kwargs = { 'queue': os.environ.get('SLURM_QUEUE', 'debug'), # e.g., 'regular', 'debug' 'account': os.environ.get('SLURM_ACCOUNT', 'my_project_account'), 'cores': 8, # Number of CPU cores per job 'memory': '16GB', # Memory per job 'walltime': '00:30:00', # Wall time for each worker job 'local_directory': os.environ.get('TMPDIR', '/tmp') # Local scratch for workers } # Initialize a SLURM cluster try: cluster = SLURMCluster(**cluster_kwargs) # Scale the cluster to request 2 jobs (each with 8 cores, 16GB memory) cluster.scale(jobs=2) print(f"Dashboard link: {cluster.dashboard_link}") # Connect Dask client to the cluster client = Client(cluster) print("Dask Client connected.") # Perform a Dask computation x = da.random.random((10000, 10000), chunks=(1000, 1000)) y = x.mean().compute() print(f"Computed mean: {y}") # Clean up resources client.close() cluster.close() print("Cluster and client closed.") except Exception as e: print(f"An error occurred: {e}") if 'cluster' in locals() and cluster is not None: cluster.close()
Debug
Known issues
breakingThe `cluster.start_workers()` and `cluster.stop_all_jobs()` methods have been removed. [2]
fix
Use `cluster.scale(N)` to request N jobs/workers and `cluster.scale(0)` to stop all jobs/workers. [2]
affects: 0.7.0+
breakingDirect arguments `port` or `dashboard_addresses` in cluster constructors are no longer allowed. [2]
fix
Pass these arguments via the `scheduler_options` dictionary, e.g., `scheduler_options={'dashboard_address': ':12435'}`. [2, 10]
affects: 0.7.0+
deprecatedParameters like `project`, `extra`, `env_extra`, `job_extra`, and `header_skip` are deprecated. [10, 11, 17, 20]
fix
Use their replacements: `account` (for `project`), `worker_extra_args` (for `extra`), `job_script_prologue` (for `env_extra`), `job_extra_directives` (for `job_extra`), and `job_directives_skip` (for `header_skip`). [10, 11, 17, 20]
affects: 0.7.4+, 0.8.0+
gotchaThe default for the `processes` parameter changed from 1 (only threads) to approximately `sqrt(cores)` (processes and threads). This can affect performance or cause memory issues if not anticipated. [2]
fix
Explicitly set `processes` and `threads_per_process` in your cluster constructor if you require a specific worker configuration. For example, `processes=1` for a purely threaded setup, or `processes=cores` for a purely multiprocess setup. [2, 3]
affects: 0.7.0+
gotchaMemory specifications (e.g., '20GB') may be interpreted differently by Dask and the job scheduler (Gigabytes vs. Gibibytes). [3]
fix
Always use 'GiB' (Gibibytes) in Dask-Jobqueue memory configuration (e.g., `memory='20GiB'`) to ensure consistent requests across Dask and the scheduler. [3]
affects: All versions
Errors
Common errors & fixes
Jobs cancelled or fail to start without clear error in Dask logs, or 'slurmstepd: error: *** JOB CANCELLED ***'
Incompatible resource requests (cores, memory, walltime) or unrecognized directives in the generated job script by the HPC scheduler. [18, 19]
fix
Inspect the generated job script with `print(cluster.job_script())` and compare it against your system's job submission requirements. Adjust cluster parameters like `job_extra_directives` or `job_directives_skip` as needed, or verify resource limits with your system administrator. [14, 17, 18]
ModuleNotFoundError on worker nodes, even if the module is available on the client.
The Python environment or executable on the worker nodes differs from the one on the client, or necessary modules are not loaded. [14]
fix
Ensure the `python` parameter in your cluster constructor points to the correct Python executable on the compute nodes. Use `job_script_prologue` to load necessary environment modules (e.g., `['module load my_conda_env']`) before Dask workers start. [14, 18]
Dask dashboard is not accessible or displays 'connection refused'.
Incorrect `dashboard_address` or firewall/network restrictions prevent access to the scheduler's dashboard port. [9]
fix
Set `scheduler_options={'dashboard_address': ':YOUR_PORT'}` to specify a free port. For remote access, you may need to set up SSH port forwarding (e.g., `ssh -L YOUR_PORT:localhost:YOUR_PORT user@head_node`) if running on an HPC login node. [9, 10]
Workers are unexpectedly killed by the job queuing system before completing tasks.
Worker jobs hit their walltime limit imposed by the HPC scheduler. [17]
fix
Increase the `walltime` parameter in your cluster configuration. For long-running or indefinite workloads, consider using the Dask worker options `--lifetime` and `--lifetime-stagger` to gracefully shut down and restart workers before walltime is reached, allowing Dask to rebalance tasks. [17]
Upgrade
Version history
0.9.0latest on PyPI · released Aug 22, 2024
Audit
Dependencies
daskrequiredCore Dask library for parallel computing.
distributedrequiredDask's distributed scheduler and worker components.
numpyoptionalCommon scientific computing dependency, often used with Dask. [12]
pandasoptionalCommon data manipulation dependency, often used with Dask. [12]
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
dask-jobqueue — pip install dask-jobqueue · libregistry