smif.controller.run.subprocess_run_scheduler module¶
Schedulers are used to run models.
The defaults provided allow model runs to be scheduled as subprocesses, or individual models to be called in series.
Future implementations may interface with common schedulers to queue up models to run in parallel and/or distributed.
Calls smif run … on the selected model in a sub process, where … are the options set in the app for info/debug messages, warm start and output format.
Summary¶
Data:
SubProcessRunScheduler |
The scheduler can run instances of smif as a subprocess and can provide information whether the modelrun is running, is done or has failed. |
Reference¶
-
class
smif.controller.run.subprocess_run_scheduler.
SubProcessRunScheduler
[source]¶ Bases:
object
The scheduler can run instances of smif as a subprocess and can provide information whether the modelrun is running, is done or has failed.
-
add
(model_run_name, args)[source]¶ Add a model_run to the Modelrun scheduler.
Parameters: Notes
There is no queuing mechanism implemented, each add will directly start a subprocess. This means that it is possible to run multiple modelruns concurrently. This may cause conflicts, it depends on the implementation whether a certain sector model / wrapper touches the filesystem or other shared resources.
-
kill
(model_run_name)[source]¶ Kill a Modelrun that is already running
Parameters: model_run_name (str) – Name of the modelrun
-
get_status
(model_run_name)[source]¶ Get the status from the Modelrun scheduler.
Parameters: model_run_name (str) – Name of the modelrun Returns: - dict (A message containing the status, command-line)
- output and error that can be directly sent back over
- the http api.
Notes
Possible status:
- unstarted:
- Model run was not started
- queing:
- Model run is waiting to be executed
- running:
- Model run is running
- stopped:
- Model run was stopped (killed) by user
- done:
- Model run was completed succesfully
- failed:
- Model run completed running with an exit code
-