A command line tool to create a sbatch file for a parameter file
Project description
Create sbatch Array Job with the same size as a parameter file
This script creates a sbatch array job with the same size as a parameter file. The parameter file is a text file with one line per job. The script reads the parameter file and creates a sbatch array job with the same number of jobs as lines in the parameter file, with the option to specify the maximum number of jobs to run concurrently.
This is similar to oarsub --array-param-file <file> in OAR. But it won't launch the jobs automatically, you need to submit the job array manually.
Usage
First make sure that your script has a logic that takes in the job index from slurm and reads the corresponding line from the parameter file. For example add this to your script:
args=$(sed -n ${SLURM_ARRAY_TASK_ID}p $1)
echo "Running with the following parameters:"
echo $args
IFS=' ' read -r -a array <<< $args
var1=${array[0]}
var2=${array[1]}
var3=${array[2]}
echo "var1: $var1"
echo "var2: $var2"
echo "var3: $var3"
Then run the tool to create the sbatch script from an existing sbatch file and a parameter file:
sbatch_paramfile <sbatch_file> <param_file> --max_run_jobs <max_run_jobs>
This will create a new sbatch file with the same name as the original sbatch file, but with _paramfile appended to the name. This new sbatch file will have the same number of jobs as lines in the parameter file, and it will add the #SBATCH --array=1-<number_of_jobs>%<max_run_jobs> line to the sbatch file.
Then submit the job array:
sbatch <output_sbatch_file> <param_file>
Contact
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 sbatch_paramfile-0.1.1.tar.gz.
File metadata
- Download URL: sbatch_paramfile-0.1.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe39eafcfe0ab95ae84c510ab664719f58dbd3e741c0a246a74985bf38a94a96
|
|
| MD5 |
5ab3ebdd7430ce31a68abd081ababd48
|
|
| BLAKE2b-256 |
97a229cdbc3b6a21dd5e219e383545db284893e5ae8f730980545c18269f26dc
|
File details
Details for the file sbatch_paramfile-0.1.1-py3-none-any.whl.
File metadata
- Download URL: sbatch_paramfile-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bea7aaf02df2c8e41de8a2185dba4f9f72ef47ddf3e3d4d44c5d565f1d796965
|
|
| MD5 |
e76faf0ec9f88cf207fa0ea4ea12d16d
|
|
| BLAKE2b-256 |
e51357c26f5ff6311f8f0535b6b18fe1d4ede1831f530055455744cbf14950b8
|