Noninteractive Termination
This MR implements a new callback. It looks for a prescribed file and reads termination conditions from it. Assuming that the filename is known and unique to each element of an array clusterjob this can be used to gracefully terminate running jobs.
"""
SleeperCallback(trigger_file, interval=30.0) <: AbstractCallback
Returns a callback that checks for the existence of `trigger_file` every `interval` seconds.
If the file exists, it is read and the following commands are supported:
- `terminate`: terminates the simulation
- `simtime=...`: terminates the simulation at the specified simulation time
- `simtime+...`: terminates the simulation at the next multiple of the specified simulation time
The callback copies the received commands to `trigger_file*"_parsed"` and deletes `trigger_file`.
"""
EDIT: A hypothetical problem is that running programs do not communicate what trigger file they are listening to.
- We could decide on a simple naming convention and just stick to it.
- We change the callback to instead produce it's own file and just listen for changes. (like before)
Edited by Jonas Isensee