simfactory: sim show-output selects inactive, queued restart

Issue #1815 closed
Frank Löffler created an issue

sim show-output NAME currently selects the 'maximum' restart for output, which in case of queued up restarts is one that isn't (yet) running. It should select the currently active restart (if there is one), given that this version of simfactory is going to be retired anyway ....

The patch could probably be done 'nicer', but this is the minimally invasive version.

Patch:

diff --git a/lib/sim-manage.py b/lib/sim-manage.py
index 87a26fd..c0e8343 100755
--- a/lib/sim-manage.py
+++ b/lib/sim-manage.py
@@ -300,7 +300,12 @@ def command_show_output():
     if simenv.OptionsManager.HasOption('restart-id'):
         restart_id = simenv.OptionsManager.GetOption('restart-id')
     else:
-        restart_id = restartlib.GetMaxRestartID(simulationName)
+        restart = simrestart.SimRestart()
+        restart.load(simulationName)
+        restart_id = restartlib.GetActiveRestartId(restart)
+        restart.done()
+        if (restart_id == None):
+          restart_id = restartlib.GetMaxRestartID(simulationName)

     restart = simrestart.SimRestart()
     ret = restart.load(simulationName, restart_id)

Keyword:

Comments (3)

  1. Log in to comment