restore previous envlist when NewExperiment is called.
- do this also on FinishExperiment - but do do do it when the proposed environment is not contained in the previous envlist + fix a typo and a minor bug in output
This commit is contained in:
24
devices.py
24
devices.py
@@ -182,8 +182,17 @@ class FrappyConfig(Device):
|
||||
before_check = before_change = prev_shown = None
|
||||
cnt = 0
|
||||
self._back_to_normal = None
|
||||
current_exp = id(session.experiment.propinfo)
|
||||
exp_changed = False
|
||||
envlist = []
|
||||
while not self._shutdown_event.wait(1):
|
||||
busy = session.daemon_device._controller.status >= 0
|
||||
if id(session.experiment.propinfo) != current_exp:
|
||||
# NewExperiment or FinishExperiment was called
|
||||
current_exp = id(session.experiment.propinfo)
|
||||
exp_changed = True
|
||||
elif not exp_changed:
|
||||
envlist = session.experiment.envlist
|
||||
if self._restarting or (busy and cnt < 10):
|
||||
# do not check while restarting and check only every 10 sec when busy
|
||||
cnt += 1
|
||||
@@ -197,6 +206,17 @@ class FrappyConfig(Device):
|
||||
self._back_to_normal = None
|
||||
cnt = 0
|
||||
need_change, changes, fm = to_consider = self.to_consider()
|
||||
if exp_changed:
|
||||
exp_changed = False
|
||||
needed = set(self.needed_envalias()[0])
|
||||
if needed == needed.intersection(envlist) and not session.experiment.envlist:
|
||||
# restore envlist from previous experiment, as it was cleared by New/FinishExperiment
|
||||
session.experiment.setEnvironment(envlist)
|
||||
session.log.info('keep environment from previous experiment: %s', ', '.join(envlist))
|
||||
continue
|
||||
# trigger output of proposed SE change
|
||||
prev_shown = None
|
||||
need_change = True
|
||||
if fm.state == before_change:
|
||||
continue
|
||||
if not need_change:
|
||||
@@ -383,7 +403,7 @@ class FrappyConfig(Device):
|
||||
- frappy('restart') # restart all frappy servers
|
||||
- frappy('reconnect') # reconnect to running frappy servers
|
||||
"""
|
||||
self._back_to_normal = None # reset 'back to normal' machanism
|
||||
self._back_to_normal = None # reset 'back to normal' mechanism
|
||||
stickarg = stick
|
||||
|
||||
need_change, changes, fm = to_consider = self.to_consider()
|
||||
@@ -650,7 +670,7 @@ class FrappyConfig(Device):
|
||||
if anew:
|
||||
return f"aliases {', '.join(anew)} should change"
|
||||
if removed:
|
||||
return f"aliases {', '.join(anew)} should be removed"
|
||||
return f"aliases {', '.join(removed)} should be removed"
|
||||
return None
|
||||
|
||||
def set_envalias(self):
|
||||
|
||||
Reference in New Issue
Block a user