From 437b37b158ff66d3573fd8accbdb5cff309aaf9d Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 12 Apr 2016 15:45:53 +0800 Subject: [PATCH] master/worker: pause/resume devices --- artiq/master/worker_impl.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/artiq/master/worker_impl.py b/artiq/master/worker_impl.py index 3c1bb41eb..4e6731ef7 100644 --- a/artiq/master/worker_impl.py +++ b/artiq/master/worker_impl.py @@ -76,12 +76,19 @@ set_watchdog_factory(Watchdog) class Scheduler: + def __init__(self, device_mgr): + self.device_mgr = device_mgr + pause_noexc = staticmethod(make_parent_action("pause")) @host_only def pause(self): - if self.pause_noexc(): - raise TerminationRequested + self.device_mgr.pause_devices() + try: + if self.pause_noexc(): + raise TerminationRequested + finally: + self.device_mgr.resume_devices() submit = staticmethod(make_parent_action("scheduler_submit")) delete = staticmethod(make_parent_action("scheduler_delete")) @@ -179,8 +186,8 @@ def main(): exp_inst = None repository_path = None - device_mgr = DeviceManager(ParentDeviceDB, - virtual_devices={"scheduler": Scheduler()}) + device_mgr = DeviceManager(ParentDeviceDB) + device_mgr.virtual_devices["scheduler"] = Scheduler(device_mgr) dataset_mgr = DatasetManager(ParentDatasetDB) try: