Execution#
Most users only need project.run(), project.submit(), or
runtraj run (Running). The functions below do the
work underneath.
run()is whatproject.run()calls. It finds the releases with missing results, runs them, and waits until they finish.task=(i, n)runs shareiofnhere (task_share()), which is whatruntraj run --task i/ndoes.submit()is whatproject.submit()calls. It writes a job array script (job_script()) whose tasks each runruntraj run --task, submits it withsbatch, and returns the job id at once. Withbackend: kubernetesit makes an indexed Job instead (job_manifest()) and creates it withkubectl.schedule_job()is whatruntraj schedulecalls: a CronJob (cron_job_manifest()) whose pod each hour runsruntraj tick, which adds the hours now due (add_due_releases()) and runs them.run_result()runs the transport model for oneSimulationand writes its particles and log.run_stages()runs the stages of the variants that share those particles: each stage file that is missing, in the order the stages read one another, and each again when what it reads was made again.run_stage()runs one, which writes its own file.run_release()runs every variant of one release, skipping what exists. Variants that share particles run the transport model once and run their stages on the particles in memory. A failure is recorded with the simulation (runtraj.Simulation.failure). Workers are always handed releases.run_releases()runs a list of releases, in this process or in a process pool.
On Slurm each task of the job array runs one share of the releases
(task_share()) with runtraj run --task. A local
run happens in this process. A program that starts the tasks itself, on
another scheduler, writes pending() to the
releases.txt each task reads (runtraj run --releases);
wait() waits for a
Slurm job array by its id.
Running#
Run every simulation of a project that has not finished, and wait for it. |
|
Submit every simulation of a project that has not finished to Slurm or Kubernetes. |
|
Return the ids of the releases a run would run, each once, in project order. |
|
Wait until every task of a Slurm job array has ended, and return how each ended. |
|
Return task task's share of release_ids, split n_tasks ways. |
Workers#
Internal: importable from their modules, and free to change.
Return the compute root of project: the directory its workdirs are made in. |
|
Run the transport model for a simulation and write its result to the output directory. |
|
Run one stage of a simulation, which writes its file to the output directory. |
|
Run the stages of the simulations of one release that share particles, and return what failed. |
|
Run every simulation of one release, and return what did not complete. |
|
Run a list of releases, in this process or in a process pool. |
Slurm job arrays#
Return the |
|
Return the |
Kubernetes indexed Jobs#
Return the indexed Job that runs a project in n_tasks pods, as a Kubernetes manifest. |
|
Make the indexed Job that runs pending releases, and return its name. |
|
Return the summaries of a project's Jobs on the cluster, oldest first ( |
|
Return what |
|
Get the met files of every unfinished simulation, one task at a time, before this task's share runs. |
|
Copy a project's inputs to url. |
|
Copy a project's inputs from url into directory, the reverse of |
|
Return a content hash of a project folder's |
Running every hour#
Make the CronJob that runs a project every hour, for the sites in its |
|
Return the CronJob that runs |
|
Return the name of a project's CronJob: |
|
Add the releases now due to a project's |
|
Return the hours a tick at now covers, oldest first, in UTC. |
|
Return the sites in a project's |
|
Return a release at each site at each hour, hour by hour. |
|
Return now in UTC without a time zone, or the clock's time when it is |
|
Hold a lock on the file name at url while the |
|
Copy one file from url into a project folder, the reverse of |
|
Copy one file of a project folder to url, such as a |
Transport model#
The worker runs a simulation through the transport model its settings name.
HYSPLIT is the one built in, and CONTRIBUTING describes how to add
another, named by its import path.
A model fails a run that its meteorology does not cover, as
MET_COVERAGE. Particles that all leave the met’s domain before the end
of the run are a complete run. Use check_model() in
the tests of a model of your own.
A transport model that follows particles from a release. |
|
A transport model that runs many releases in one call, such as an emulator on a GPU. |
|
The base of every transport model's config. |
|
What one model run produced. |
|
Return the transport model name names. |
|
Run the transport model called name for one release, and finish its result. |
|
Run a batched transport model once for many releases, and finish each one's particles. |
|
Return the met files of a run of the transport model name as |
|
Check that model keeps the promises runtraj relies on, for one config. |
|
HYSPLIT as a transport model, the object |
Stages#
A stage makes one file per release from a simulation’s results, after the
transport model runs. PYSTILT’s footprint is one
(stilt.footprint.FootprintStage). A stages block of
config.yaml names its stage’s class by import path, so a stage in a
package of your own needs no registration, and CONTRIBUTING describes how to
write one. Use check_stage() in its tests.
What is made from each simulation's results: one file per release. |
|
Return the stage whose class is at the import path path, made with no arguments. |
|
Return the names of stages in the order they run: each after the stages it reads. |
|
Check that stage keeps the promises the worker and the output directory rely on, for one config. |