Batch Systems
🪵 How to use different known batch systems for scalable job execution.
Last updated
Was this helpful?
Was this helpful?
// isabl cli's settings
{
...
"SUBMIT_ANALYSES": "isabl_cli.batch_systems.submit_slurm",
"SUBMIT_CONFIGURATION": {
"extra_args": " -p GPU_PARTITION ",
"get_requirements": "my_isabl_extension.batch_systems.get_slurm_requirements",
"throttle_by": 50,
"unbuffer": True,
},
"SUBMIT_MERGE_ANALYSIS": "my_isabl_extension.batch_systems.submit_merge_analysis_to_slurm",
...
}# my_isabl_extension/batch_systems.py
from my_isabl_extension import apps
def get_slurm_requirements(app, targets_methods):
"""Get custom requirements for any app or method."""
# Defaults
runtime = 240 # 6 hours
cores = 1
memory = 6
# Technique.method-specific
method = targets_methods[0]
if method == "WG":
runtime = 10080 # 7 days
# Application-specific
if isinstance(app, apps.BwaMemGRCh37):
cores = 32
runtime = 1440 # 24 hours
memory = 8
return (
f"--ntasks=1 "
f"--cpus-per-task={cores} "
f"--time={runtime} "
f"--mem-per-cpu={memory}G "
)
def submit_merge_analysis_to_slurm(instance, application, command):
"""Submit command to run merge in slurm."""
command = f"sbatch --ntasks=1 --cpus-per-task=1 --mem=32G {command}"
subprocess.check_call(command.split())
click.secho(f"Submitted project level merge with: {command}", fg="yellow")