1 Commits

Author SHA1 Message Date
1c43c070f1 preserve environment list over experiment changes
detect NewExperiment or FinishExperiment and restore
the previous environment if some of them are needed
for the current running frappy/sea servers
2025-10-30 10:11:35 +01:00

View File

@@ -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):