stilt.execution.run#

stilt.execution.run(project, *, receptors=None, task=None, execution=None, skip_existing=True, compute_root=None)[source]#

Run every simulation of a project that has not finished, and wait for it.

Each receptor with missing results runs once: the transport model once for each distinct set of transport settings whose particles are missing, then the footprint of every variant that has a grid. With backend: local the receptors run in this process (cpus at a time). With backend: slurm they are submitted as one job array (submit()) and this waits for it. When some simulations look unfinished after the job ends, their results are listed once more RELIST_SECONDS later, since a network filesystem can show this node new files late.

Parameters:
  • project (Project) – Project to run.

  • receptors (Iterable[str] | None) – Run only these receptors (their ids), in this order.

  • task (tuple[int, int] | None) – (i, n): run share i of n of the receptors here, in this process, whatever the backend. The share is every n-th receptor in project order (or in receptors order), starting at i (task_share()), whether it is complete or not, and the complete ones are then skipped. Each task of a job array or a Kubernetes indexed Job runs one share, and every task splits the receptors the same way whenever it starts.

  • execution (ExecutionConfig | None) – Where to run and with what resources. Defaults to the execution settings of the project’s config.

  • skip_existing (bool) – Skip simulations whose results all exist. False runs every simulation again.

  • compute_root (str | Path | None) – Directory the workdirs are made in, a new one for each run (resolve_compute_root()). On Slurm it is resolved on the compute node unless given here.

Returns:

The status table (stilt.Project.status()) of the simulations that ran: state says which are complete, which failed and why, and which did not finish.

Return type:

DataFrame

Raises:

ValueError – If a receptor id is not in the project, or task is not from 0 to n - 1.

Notes

In a Slurm job, a task (task given) that stops with work left requeues itself with scontrol requeue when it was preempted (Slurm set the job’s PreemptTime) or got SIGUSR1, which the job array script asks Slurm to send NOTICE_SECONDS before the time limit. It starts again later and skips what it finished. A task stopped by scancel is not requeued.