runtraj.execution.worker.run_result#

runtraj.execution.worker.run_result(sim, *, workdir, keep_workdir=False, timeout=None)[source]#

Run the transport model for a simulation and write its result to the output directory.

The transport model the variant names runs in workdir (runtraj.models.run_model()), with the variant’s met. Its log is written to the output directory whether the run succeeds or fails. The working directory is then removed, unless the run failed or keep_workdir is set, in which case it is copied under the output directory’s scratch/ first. A failed run’s copy leaves out the model’s result_files.

Parameters:
  • sim (Simulation) – What to run.

  • workdir (Path) – Directory to run in, made here. Anything in it is removed first, so each run needs its own.

  • keep_workdir (bool) – Keep the working directory of a successful run too.

  • timeout (int | None) – Time limit for the transport model run, in seconds.

Returns:

The result, of the variant’s type (the particles, for most), also written to the output directory.

Return type:

Any

Raises:

SimulationError – As the transport model raises it (with a reason), or with reason NO_PARTICLE_DATA when the model wrote no particles (NO_CONCENTRATION_DATA for a concentration result). MeteorologyError when the met files are missing.