cluv (from 'cluster' + 'uv') - A versatile tool to work with uv python projects across HPC clusters.
Project description
cluv
cluv — sync UV-based Python projects across HPC clusters.
Status
In early development. Commands are functional, but expect bugs or missing features.
Requirements
- Python >= 3.13
- UV
- SSH access configured for each cluster in
~/.ssh/config(runcluv loginto open ControlMaster sessions) - A GitHub repository with your project
Installation
Install as a UV tool:
uv tool install git+https://github.com/mila-iqia/cluv
Then you can run cluv directly as a command:
cluv init
cluv login mila
cluv sync mila
cluv submit mila job.sh
Quick Start
- Initialize your project with:
cluv init - Establish SSH connections to all configured clusters:
cluv login - Sync your project to all clusters and run
uv syncon each:cluv sync
Examples
See the examples folder for sample projects using cluv. Each example includes a README with instructions specific to that project.
Configuration
Add a [tool.cluv] section to the pyproject.toml of your project. cluv init generates a default config, or you can write it by hand.
See the config at the project root for an example, or refer to the schema below.
Top-level fields
| Field | Type | Description |
|---|---|---|
clusters |
table | Per-cluster settings, keyed by SSH hostname from ~/.ssh/config. |
env |
table | Global environment variables applied to all clusters. |
results_path |
string | Path relative to the project root for storing results. cluv sync rsyncs that directory back from each remote cluster. |
[tool.cluv.clusters.<name>.env]
Environment variables for a specific cluster. Values here are merged on top of [tool.cluv.env] when submitting.
Variables priority
Environment variables can be set at multiple levels when submitting jobs, with the following precedence (highest to lowest):
- Command-line arguments to
cluv submit. - Cluster-specific variables in
[tool.cluv.clusters.<name>.env] - Global variables in
[tool.cluv.env] - SBATCH directives inside the job script (e.g.
#SBATCH --export=VAR=value) - Default values from the cluster (e.g.
SBATCH_PARTITION)
Example
Here's an example pyproject.toml with cluv configuration for three clusters, and some global and cluster-specific environment variables:
[tool.cluv]
results_path = "logs"
[tool.cluv.env]
SBATCH_TIMELIMIT = "3:00:00"
WANDB_MODE = "offline"
[tool.cluv.clusters.mila]
env = { WANDB_MODE="online", SBATCH_PARTITION="long" }
[tool.cluv.clusters.narval]
[tool.cluv.clusters.tamia]
Commands
cluv init
Initialize the current directory as a cluv project. Must be run from inside your $HOME directory.
cluv init
Default project structure after cluv init:
my_project/
├── README.md
├── logs -> $SCRATCH/logs/my_project # symlink to $SCRATCH
├── pyproject.toml # includes [tool.cluv] config
├── scripts/
│ ├── job.sh # Slurm job script template
│ └── safe_job.sh # Slurm job script template (copies .venv and prior results)
└── src/
└── my_project/
└── __init__.py
cluv login
Open SSH ControlMaster connections to all configured clusters. Run this before any command that requires a live connection.
cluv login [<cluster> ...]
cluv sync
Push local git changes, then on each cluster: clone or fetch the repo, check out the current branch, and run uv sync. Optionally rsyncs results back if results_path is set in the config.
cluv sync [<cluster> ...]
cluv status
Display an overview of :
- Cluster: GPU availability, running/queued jobs and disk usage.
- Jobs: cached jobs from
cluv submitwith their status.
cluv status [<table>]
cluv submit
Submit a SLURM job on a remote cluster.
cluv submit <cluster> <job.sh> [<sbatch-flags> ...] [-- <program-args> ...]
For example:
cluv submit rorqual script/job.sh --time=00:10:00 -- python main.py
cluv run
Sync the project to a cluster, then run a command there with uv run.
cluv run <cluster> <command> [<args> ...]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cluster_uv-0.0.1.post1.tar.gz.
File metadata
- Download URL: cluster_uv-0.0.1.post1.tar.gz
- Upload date:
- Size: 156.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d9f201028184fb9295e1f22ad86c21eb4be528b60fadffcf481ff46bea0b00c
|
|
| MD5 |
a91018be288b8a62e814bf8cbaa790c9
|
|
| BLAKE2b-256 |
6d3211a18c2dde8186030972b0d5d92c2082468ee40617f027ca70694323cfc2
|
Provenance
The following attestation bundles were made for cluster_uv-0.0.1.post1.tar.gz:
Publisher:
publish.yaml on mila-iqia/cluv
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cluster_uv-0.0.1.post1.tar.gz -
Subject digest:
1d9f201028184fb9295e1f22ad86c21eb4be528b60fadffcf481ff46bea0b00c - Sigstore transparency entry: 2129994015
- Sigstore integration time:
-
Permalink:
mila-iqia/cluv@3d25cf582b3fad289151b59cf9ec901d9c94e18f -
Branch / Tag:
refs/tags/v0.0.1.post1 - Owner: https://github.com/mila-iqia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@3d25cf582b3fad289151b59cf9ec901d9c94e18f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file cluster_uv-0.0.1.post1-py3-none-any.whl.
File metadata
- Download URL: cluster_uv-0.0.1.post1-py3-none-any.whl
- Upload date:
- Size: 51.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6391b05a80b00ee698e83a5c7458dfaf2b265f6091a75b15d06818da261aa9d
|
|
| MD5 |
5e6d0158a840ab6a3cf0876409279eb1
|
|
| BLAKE2b-256 |
6dd2084a20fe609d2e7370f29eeb22693e56a540dc26ade7964c1187a34bfd78
|
Provenance
The following attestation bundles were made for cluster_uv-0.0.1.post1-py3-none-any.whl:
Publisher:
publish.yaml on mila-iqia/cluv
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cluster_uv-0.0.1.post1-py3-none-any.whl -
Subject digest:
b6391b05a80b00ee698e83a5c7458dfaf2b265f6091a75b15d06818da261aa9d - Sigstore transparency entry: 2129994164
- Sigstore integration time:
-
Permalink:
mila-iqia/cluv@3d25cf582b3fad289151b59cf9ec901d9c94e18f -
Branch / Tag:
refs/tags/v0.0.1.post1 - Owner: https://github.com/mila-iqia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@3d25cf582b3fad289151b59cf9ec901d9c94e18f -
Trigger Event:
workflow_dispatch
-
Statement type: