runtraj.execution.slurm.job_script#
- runtraj.execution.slurm.job_script(project, execution, folder, n_tasks, *, skip_existing=True, compute_root=None)[source]#
Return the
sbatchscript of a job array whose tasks each run a share of the releases.Task
irunsruntraj run <project> --releases <folder>/releases.parquet --task i/n_tasks --execution <folder>/execution.yaml --cpus <cpus>with the Python that called this: a task runs its share here,cpusreleases at once. The#SBATCHlines come from execution’sslurmblock: its resources,--requeue,--signal=B:USR1@120, and its othersbatchoptions, which can replace any of them. Itssetupcommands run before the task, after the script exportsOMP_NUM_THREADSas the task’s CPUs divided by the workers it runs at once (cpus), which asetupline can export again. NumPy’s BLAS follows it, so a worker does not start a thread pool the size of the node.The script runs the task as a child and waits for it, so that it can put the task back in the queue (
scontrol requeue) when the task exits with 3, stopped with work left, after Slurm’s notice of the time limit (SIGUSR1,NOTICE_SECONDSbefore it, which the script passes on as SIGTERM) or a preemption (scontrol show jobgives aPreemptTime). A task stopped withscancelis not requeued, nor one requeuedMAX_REQUEUEStimes already. A requeued task starts again and skips what it finished.