mirror of https://github.com/m-labs/artiq.git
Revert "master/worker_db: add pause_devices and resume_devices"
This reverts commit 3c70bc40a4
.
This commit is contained in:
parent
ca9724f517
commit
44724197c5
|
@ -119,9 +119,7 @@ class DeviceError(Exception):
|
||||||
class DeviceManager:
|
class DeviceManager:
|
||||||
"""Handles creation and destruction of local device drivers and controller
|
"""Handles creation and destruction of local device drivers and controller
|
||||||
RPC clients."""
|
RPC clients."""
|
||||||
def __init__(self, ddb, virtual_devices=None):
|
def __init__(self, ddb, virtual_devices=dict()):
|
||||||
if virtual_devices is None:
|
|
||||||
virtual_devices = dict()
|
|
||||||
self.ddb = ddb
|
self.ddb = ddb
|
||||||
self.virtual_devices = virtual_devices
|
self.virtual_devices = virtual_devices
|
||||||
self.active_devices = OrderedDict()
|
self.active_devices = OrderedDict()
|
||||||
|
@ -158,28 +156,6 @@ class DeviceManager:
|
||||||
self.active_devices[name] = dev
|
self.active_devices[name] = dev
|
||||||
return dev
|
return dev
|
||||||
|
|
||||||
def pause_devices(self):
|
|
||||||
"""Pauses all active devices, in the opposite order as they were
|
|
||||||
requested."""
|
|
||||||
for dev in reversed(list(self.active_devices.values())):
|
|
||||||
if hasattr(dev.__class__, "pause"):
|
|
||||||
try:
|
|
||||||
dev.pause()
|
|
||||||
except:
|
|
||||||
logger.warning("Exception when pausing device %r", dev,
|
|
||||||
exc_info=True)
|
|
||||||
|
|
||||||
def resume_devices(self):
|
|
||||||
"""Resumes all active devices, in the same order as they were
|
|
||||||
requested."""
|
|
||||||
for dev in self.active_devices.values():
|
|
||||||
if hasattr(dev.__class__, "resume"):
|
|
||||||
try:
|
|
||||||
dev.resume()
|
|
||||||
except:
|
|
||||||
logger.warning("Exception when resuming device %r", dev,
|
|
||||||
exc_info=True)
|
|
||||||
|
|
||||||
def close_devices(self):
|
def close_devices(self):
|
||||||
"""Closes all active devices, in the opposite order as they were
|
"""Closes all active devices, in the opposite order as they were
|
||||||
requested."""
|
requested."""
|
||||||
|
@ -187,11 +163,10 @@ class DeviceManager:
|
||||||
try:
|
try:
|
||||||
if isinstance(dev, (Client, BestEffortClient)):
|
if isinstance(dev, (Client, BestEffortClient)):
|
||||||
dev.close_rpc()
|
dev.close_rpc()
|
||||||
elif hasattr(dev.__class__, "close"):
|
elif hasattr(dev, "close"):
|
||||||
dev.close()
|
dev.close()
|
||||||
except:
|
except Exception as e:
|
||||||
logger.warning("Exception when closing device %r", dev,
|
logger.warning("Exception %r when closing device %r", e, dev)
|
||||||
exc_info=True)
|
|
||||||
self.active_devices.clear()
|
self.active_devices.clear()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue