nismod/smif

`smif step <model> <timestep>` runs a model for a timestep

Closed this issue · 0 comments

Is your feature request related to a problem? Please describe.
We need to run individual models with a single command in order to run the on DAFNI as separate units in the NIMS.

This would also allow a model developer to step through debugging a model run.

Describe the solution you'd like
CLI subcommand smif step to run a single model for a single timestep/decision iteration in the context of a model run, using the existing config/data directory structure:

smif step --model energy_demand_constrained --timestep 2020 --model_run test_energy [--interface local_csv] [--directory .]

Describe alternatives you've considered

  • Python API to run a model - clear up what to build and set up in order to get to model.simulate
  • variations on how to set up/pass in inputs and parameters
    • pass in a model run id, read config and deduce where to find necessary files
    • set up a simpler inputs file (or fit it all on the CLI?) specifying locations (whose job would it be to create this? would it make the running lighter/simpler?)

Somehow with all the inputs and parameters clearly specified:

smif step --model energy_demand_constrained --timestep 2020 --input-file smif_inputs.yaml

where smif_inputs.yaml somehow specifies all the resolved input and parameter files and means we avoid re-parsing all the model_run/sos_model/model config. The aim here would be a simpler step function with less reliance on the stack of smif config. This might be able to cut through some of the DataHandle/Store overhead. But someone would need to write this file - possibly smif run up front.

Additional context

  • may need to double check model wrapper object state in particular implementations
  • before_model_run separate or included?
  • probably not in scope here, but it can be useful to run a single model over multiple timesteps - there can potentially be optimisations here if a model can persist its data structures in memory; would likely need wrapper and/or model rewriting to take advantage of this - at a minimum, can we leave the door open with this design?