runtraj.execution.slurm.job_script#

runtraj.execution.slurm.job_script(project, execution, folder, n_tasks, *, skip_existing=True, compute_root=None)[source]#

Return the sbatch script of a job array whose tasks each run a share of the releases.

Task i runs runtraj 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, cpus releases at once. The #SBATCH lines come from execution’s slurm block: its resources, --requeue, --signal=B:USR1@120, and its other sbatch options, which can replace any of them. Its setup commands run before the task, after the script exports OMP_NUM_THREADS as the task’s CPUs divided by the workers it runs at once (cpus), which a setup line 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_SECONDS before it, which the script passes on as SIGTERM) or a preemption (scontrol show job gives a PreemptTime). A task stopped with scancel is not requeued, nor one requeued MAX_REQUEUES times already. A requeued task starts again and skips what it finished.

Return type:

str

Parameters: