xarray-contrib / xarray-simlab

Xarray extension and framework for computer model simulations
http://xarray-simlab.readthedocs.io
BSD 3-Clause "New" or "Revised" License
73 stars 9 forks source link

WIP: add simulation runtime hooks #95

Closed benbovy closed 4 years ago

benbovy commented 4 years ago

This PR supersedes #93. After discussion with @rlange2, we needed to think more about the design. Using the generic "callback" term was probably not the most appropriate to describe this feature. I'm now pretty happy with a @runtime_hook decorator for simple functions and a RuntimeDiagnostics base class for more advanced simulation runtime diagnostics.

benbovy commented 4 years ago

"Diagnostics" is a bit too specific to describe the feature after all. Runtime hooks may be useful not only for monitoring a simulation, but also for controlling its execution (e.g., early stopping the simulation after some time exceeded or based on another condition, skip the rest of the time step execution and continue, etc.) possibly via specific signals returned by runtime hook functions (That we can implement later).

benbovy commented 4 years ago

Unfortunately, Sphinx IPython directive doesn't work well with classes (https://github.com/ipython/ipython/issues/11362)