mirror of https://github.com/m-labs/artiq.git
devices: introduce notify_run_end API
This commit is contained in:
parent
795c4372fa
commit
ede0b37c6e
|
@ -222,6 +222,7 @@ def run(with_file=False):
|
|||
exp_inst = _build_experiment(device_mgr, dataset_mgr, args)
|
||||
exp_inst.prepare()
|
||||
exp_inst.run()
|
||||
device_mgr.notify_run_end()
|
||||
exp_inst.analyze()
|
||||
except CompileError as error:
|
||||
return
|
||||
|
|
|
@ -804,6 +804,7 @@ def main():
|
|||
experiment = SinaraTester((device_mgr, None, None, None))
|
||||
experiment.prepare()
|
||||
experiment.run(tests)
|
||||
device_mgr.notify_run_end()
|
||||
experiment.analyze()
|
||||
finally:
|
||||
device_mgr.close_devices()
|
||||
|
|
|
@ -92,6 +92,13 @@ class DeviceManager:
|
|||
self.active_devices.append((desc, dev))
|
||||
return dev
|
||||
|
||||
def notify_run_end(self):
|
||||
"""Sends a "end of Experiment run stage" notification to
|
||||
all active devices."""
|
||||
for _desc, dev in self.active_devices:
|
||||
if hasattr(dev, "notify_run_end"):
|
||||
dev.notify_run_end()
|
||||
|
||||
def close_devices(self):
|
||||
"""Closes all active devices, in the opposite order as they were
|
||||
requested."""
|
||||
|
|
|
@ -343,6 +343,8 @@ def main():
|
|||
# for end of analyze stage.
|
||||
write_results()
|
||||
raise
|
||||
finally:
|
||||
device_mgr.notify_run_end()
|
||||
put_completed()
|
||||
elif action == "analyze":
|
||||
try:
|
||||
|
|
|
@ -55,6 +55,7 @@ class ExperimentCase(unittest.TestCase):
|
|||
try:
|
||||
exp = self.create(cls, *args, **kwargs)
|
||||
exp.run()
|
||||
self.device_mgr.notify_run_end()
|
||||
exp.analyze()
|
||||
return exp
|
||||
except CompileError as error:
|
||||
|
|
Loading…
Reference in New Issue