runtraj.execution.submit#

runtraj.execution.submit(project, *, releases=None, execution=None, skip_existing=True, compute_root=None)[source]#

Submit every simulation of a project that has not finished to Slurm or Kubernetes.

The releases with missing results are split among up to n_workers tasks of one job array, and this returns once it is submitted. The submission is a folder _slurm/<date_time>_<id>/ in the project: releases.txt lists the releases to run, releases.parquet holds their checked rows from releases.csv, execution.yaml holds the execution settings, job.sh is the script given to sbatch, and <task>.log is each task’s log. Task i runs runtraj run <project> --releases releases.parquet --task i/N, so it does not read and check all of releases.csv again. A task that is preempted or nears its time limit requeues itself and skips what it finished (see run()).

When a met the unfinished simulations use downloads its files, a fetch job goes first: one task that runs runtraj fetch <project> --releases releases.parquet (fetch_script()), written to fetch.sh with its log in fetch.log, with the resources of execution.slurm.fetch. The array waits for it to end (--dependency=afterany), however it ended, so the runs whose met it got go ahead, and each task downloads what is still missing. With skip_existing=False it gets the met of every run the array makes again. If sbatch refuses the array, the fetch job is cancelled. Set execution.slurm.fetch to false for no fetch job.

With backend: kubernetes it makes one indexed Job instead, whose pods each run runtraj run <project> --task I/N (runtraj.execution.kubernetes.submit_job()), and creates it with kubectl. Each task runs its share of every release of the project and skips the complete ones, so releases and skip_existing=False are refused there, and compute_root is each pod’s own.

Parameters:
Returns:

The Slurm job id of the array, or the name of the Kubernetes Job, or None when nothing needs to run. squeue -j <id> follows a job array and scancel <id> stops it; kubectl get job <name> and kubectl delete job <name> do the same for a Job. A fetch job is a job of its own: its id is logged and written to fetch.id in the submission folder, and scancel stops it too.

Return type:

str | None

Raises:

ValueError – If the execution backend is local, or on Kubernetes with releases or skip_existing=False.