Slurm extension for Metaflow
Project description
SLURM extension for Metaflow
This extension adds support for executing steps in Metaflow Flows on SLURM clusters.
Basic Usage
- Have a SLURM cluster that you have public access for.
- This includes the username, the IP address and the PEM file (at minimum)
- Simply add the
@slurmdecorator to the step you want to run on the SLURM cluster.
@slurm(
username="ubuntu",
address="A.B.C.D",
ssh_key_file="~/path/to/ssh/pem/file.pem"
)
Note that the above parameters can also be configured via the following environment variables:
METAFLOW_SLURM_USERNAMEMETAFLOW_SLURM_ADDRESSMETAFLOW_SLURM_SSH_KEY_FILE
The step that is decorated with @slurm will create the following directory structure on the cluster.
metaflow/
├── assets
│ └── madhurMovies218892mid13433160
│ └── metaflow
│ ├── INFO
│ ├── demo.py
│ ├── job.tar
│ ├── linux-64
│ ├── metaflow
│ ├── metaflow_extensions
│ └── micromamba
├── madhurMovies218892mid13433160.sh
├── stderr
│ └── madhurMovies218892mid13433160.stderr
└── stdout
└── madhurMovies218892mid13433160.stdout
In the above output, demo.py was the name of our flow file.
One can pass cleanup=True in the decorator to clear up the contents of the assets folder.
This clears up all the artifacts created by Metaflow.
Using cleanup=True will not delete:
stdoutfolderstderrfolder- the generated shell script i.e.
madhurMovies218892mid13433160.sh
This is useful for debugging later and may be manually deleted by logging into the slurm cluster.
Supplying Credentials
Credentials need to be supplied to be able to download the code package. They can:
- either exist on the Slurm cluster itself, i.e. compute instances have access to the blob store
- supplied via the
@environmentdecorator
@environment(vars={
"AWS_ACCESS_KEY_ID": "XXXX",
"AWS_SECRET_ACCESS_KEY": "YYYY"
})
Note that this will expose the credentials in the shell script that is generated i.e.
madhurMovies218892mid13433160.sh will have the following contents present:
export AWS_ACCESS_KEY_ID='XXXX'
export AWS_SECRET_ACCESS_KEY='YYYY'
- hydrating environment variables with the @secrets decorator from a secret manager.
PS -- If you are on the Outerbounds platform, the auth is taken care of and there is no need to fiddle with it.
Things to be taken care of
- The extension runs workloads via shell scripts and
sbatchin a linux native environment- i.e. the workloads are NOT run inside docker containers
- As such, the compute instances should have
python3installed (above 3.8 preferrably) - If the default
pythonpoints topython2, one can use thepath_to_python3argument of the decorator i.e.
@slurm(
path_to_python3="/usr/bin/python3",
)
Fin.
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 metaflow_slurm-0.0.4.tar.gz.
File metadata
- Download URL: metaflow_slurm-0.0.4.tar.gz
- Upload date:
- Size: 20.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b56a7e51aa54fca09ba67b0ad9a5dd16433a49063b34b5a7f3bbc4c884be1a79
|
|
| MD5 |
6fd1625fbac507c4276a76cf4cff2933
|
|
| BLAKE2b-256 |
23e73e4e852eb232b5ae7a2d083bfe96c68fb372ae0f2943896f4cb0c756be0c
|
Provenance
The following attestation bundles were made for metaflow_slurm-0.0.4.tar.gz:
Publisher:
publish.yml on outerbounds/metaflow-slurm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
metaflow_slurm-0.0.4.tar.gz -
Subject digest:
b56a7e51aa54fca09ba67b0ad9a5dd16433a49063b34b5a7f3bbc4c884be1a79 - Sigstore transparency entry: 154537836
- Sigstore integration time:
-
Permalink:
outerbounds/metaflow-slurm@ae0995a5643e9540b84a41100531cd79db848ced -
Branch / Tag:
refs/tags/0.0.4 - Owner: https://github.com/outerbounds
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ae0995a5643e9540b84a41100531cd79db848ced -
Trigger Event:
release
-
Statement type:
File details
Details for the file metaflow_slurm-0.0.4-py3-none-any.whl.
File metadata
- Download URL: metaflow_slurm-0.0.4-py3-none-any.whl
- Upload date:
- Size: 23.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c20df8d4829ed9f1d3e6f58669676831ab01bc00adba2e137848ffd6fe83b141
|
|
| MD5 |
8375785f033245130ea5f2772d071801
|
|
| BLAKE2b-256 |
790641e7ead98e047fc50857f845b39e8584827543c8394914e4353d840d5d29
|
Provenance
The following attestation bundles were made for metaflow_slurm-0.0.4-py3-none-any.whl:
Publisher:
publish.yml on outerbounds/metaflow-slurm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
metaflow_slurm-0.0.4-py3-none-any.whl -
Subject digest:
c20df8d4829ed9f1d3e6f58669676831ab01bc00adba2e137848ffd6fe83b141 - Sigstore transparency entry: 154537838
- Sigstore integration time:
-
Permalink:
outerbounds/metaflow-slurm@ae0995a5643e9540b84a41100531cd79db848ced -
Branch / Tag:
refs/tags/0.0.4 - Owner: https://github.com/outerbounds
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ae0995a5643e9540b84a41100531cd79db848ced -
Trigger Event:
release
-
Statement type: