mirror of https://github.com/m-labs/artiq.git
master/worker: pause/resume devices
This commit is contained in:
parent
3c70bc40a4
commit
437b37b158
|
@ -76,12 +76,19 @@ set_watchdog_factory(Watchdog)
|
||||||
|
|
||||||
|
|
||||||
class Scheduler:
|
class Scheduler:
|
||||||
|
def __init__(self, device_mgr):
|
||||||
|
self.device_mgr = device_mgr
|
||||||
|
|
||||||
pause_noexc = staticmethod(make_parent_action("pause"))
|
pause_noexc = staticmethod(make_parent_action("pause"))
|
||||||
|
|
||||||
@host_only
|
@host_only
|
||||||
def pause(self):
|
def pause(self):
|
||||||
|
self.device_mgr.pause_devices()
|
||||||
|
try:
|
||||||
if self.pause_noexc():
|
if self.pause_noexc():
|
||||||
raise TerminationRequested
|
raise TerminationRequested
|
||||||
|
finally:
|
||||||
|
self.device_mgr.resume_devices()
|
||||||
|
|
||||||
submit = staticmethod(make_parent_action("scheduler_submit"))
|
submit = staticmethod(make_parent_action("scheduler_submit"))
|
||||||
delete = staticmethod(make_parent_action("scheduler_delete"))
|
delete = staticmethod(make_parent_action("scheduler_delete"))
|
||||||
|
@ -179,8 +186,8 @@ def main():
|
||||||
exp_inst = None
|
exp_inst = None
|
||||||
repository_path = None
|
repository_path = None
|
||||||
|
|
||||||
device_mgr = DeviceManager(ParentDeviceDB,
|
device_mgr = DeviceManager(ParentDeviceDB)
|
||||||
virtual_devices={"scheduler": Scheduler()})
|
device_mgr.virtual_devices["scheduler"] = Scheduler(device_mgr)
|
||||||
dataset_mgr = DatasetManager(ParentDatasetDB)
|
dataset_mgr = DatasetManager(ParentDatasetDB)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue