Skip to main content

MLFlow-Slurm

Backend for executing MLFlow projects on Slurm batch system

Usage

Install this package in the environment from which you will be submitting jobs. If you are submitting jobs from inside jobs, make sure you have this package listed in your conda or pip environment.

Just list this as your --backend in the job run. You should include a json config file to control how the batch script is constructed:

mlflow run --backend slurm \
          --backend-config slurm_config.json \
          examples/sklearn_elasticnet_wine

It will generate a batch script named after the job id and submit it via the Slurm sbatch command. It will tag the run with the Slurm JobID

Configure Jobs

You can set values in a json file to control job submission. The supported properties in this file are:

Config File Setting Use
partition Which Slurm partition should the job run in?
account What account name to run under
environment List of additional environment variables to add to the job
exports List of environment variables to export to the job
gpus_per_node On GPU partitions how many GPUs to allocate per node
gres SLURM Generic RESources requests
mem Amount of memory to allocate to CPU jobs
modules List of modules to load before starting job
nodes Number of nodes to request from SLURM
ntasks Number of tasks to run on each node
exclusive Set to true to insure jobs don't share a node with other jobs
time Max CPU time job may run
sbatch-script-file Name of batch file to be produced. Leave blank to have service generate a script file name based on the run ID

Sequential Worker Jobs

There are occasions where you have a job that can't finish in the maximum allowable wall time. If you are able to write out a checkpoint file, you can use sequential worker jobs to continue the job where it left off. This is useful for training deep learning models or other long running jobs.

To use this, you just need to provide a parameter to the mlflow run command

  mlflow run --backend slurm -c ../../slurm_config.json -P sequential_workers=3 .

This will the submit the job as normal, but also submit 3 additional jobs that each depend on the previous job. As soon as the first job terminates, the next job will start. This will continue until all jobs have completed.

Development

The slurm docker deployment is handy for testing and development. You can start up a slurm environment with the included docker-compose file

Metadata

Release files for mlflow-slurm 1.0.6

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

Source distribution (sdist)

Source distribution for mlflow-slurm 1.0.6
File Size Uploaded
mlflow_slurm-1.0.6.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mlflow-slurm 1.0.6
File Interpreter ABI Platform
mlflow_slurm-1.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 16.5 kB

Release files / mlflow_slurm-1.0.6.tar.gz

Download URL mlflow_slurm-1.0.6.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9aad85243dc78652c7c068f6db80abed1d034d8ee2969629333d8a624e8716cb
BLAKE2b-256 checksum
How to use checksums
bead8aa120650815ccf89e1ee3ef301da4c4af787854927f8afbdd0b8d70f080
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.8.20

Release files / mlflow_slurm-1.0.6-py3-none-any.whl

Download URL mlflow_slurm-1.0.6-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e31830cbafb4fa58902fbb3157e49d71184c230695c2dec4013e8a34b0d4fab
BLAKE2b-256 checksum
How to use checksums
45d3dbff3783dc25af19943d4245888f89050bda0029af19ae51ac412a59a3f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.8.20
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