mirror of https://github.com/m-labs/artiq.git
master: implement devarg_override
This commit is contained in:
parent
5df0721811
commit
8dd8cfa6b0
|
@ -19,12 +19,13 @@ class DummyDevice:
|
|||
pass
|
||||
|
||||
|
||||
def _create_device(desc, device_mgr):
|
||||
def _create_device(desc, device_mgr, argument_overrides):
|
||||
ty = desc["type"]
|
||||
if ty == "local":
|
||||
module = importlib.import_module(desc["module"])
|
||||
device_class = getattr(module, desc["class"])
|
||||
return device_class(device_mgr, **desc.get("arguments", {}))
|
||||
arguments = desc.get("arguments", {}) | argument_overrides
|
||||
return device_class(device_mgr, **arguments)
|
||||
elif ty == "controller":
|
||||
if desc.get("best_effort", False):
|
||||
cls = BestEffortClient
|
||||
|
@ -60,6 +61,7 @@ class DeviceManager:
|
|||
self.ddb = ddb
|
||||
self.virtual_devices = virtual_devices
|
||||
self.active_devices = []
|
||||
self.devarg_override = {}
|
||||
|
||||
def get_device_db(self):
|
||||
"""Returns the full contents of the device database."""
|
||||
|
@ -85,7 +87,7 @@ class DeviceManager:
|
|||
return existing_dev
|
||||
|
||||
try:
|
||||
dev = _create_device(desc, self)
|
||||
dev = _create_device(desc, self, self.devarg_override.get(name, {}))
|
||||
except Exception as e:
|
||||
raise DeviceError("Failed to create device '{}'"
|
||||
.format(name)) from e
|
||||
|
|
|
@ -306,6 +306,8 @@ def main():
|
|||
start_time = time.time()
|
||||
rid = obj["rid"]
|
||||
expid = obj["expid"]
|
||||
if "devarg_override" in expid:
|
||||
device_mgr.devarg_override = expid["devarg_override"]
|
||||
if "file" in expid:
|
||||
if obj["wd"] is not None:
|
||||
# Using repository
|
||||
|
|
Loading…
Reference in New Issue