diff --git a/artiq/master/worker_db.py b/artiq/master/worker_db.py index b9f76bae0..3ba176e09 100644 --- a/artiq/master/worker_db.py +++ b/artiq/master/worker_db.py @@ -9,7 +9,7 @@ import numpy import h5py from artiq.protocols.sync_struct import Notifier -from artiq.protocols.pc_rpc import Client, BestEffortClient +from artiq.protocols.pc_rpc import AutoTarget, Client, BestEffortClient logger = logging.getLogger(__name__) @@ -25,8 +25,13 @@ def _create_device(desc, device_mgr): if desc["best_effort"]: cl = BestEffortClient else: - cl = Client - return cl(desc["host"], desc["port"], desc["target_name"]) + cls = Client + # Automatic target can be specified either by the absence of + # the target_name parameter, or a None value. + target_name = desc.get("target_name", None) + if target_name is None: + target_name = AutoTarget + return cls(desc["host"], desc["port"], target_name) else: raise ValueError("Unsupported type in device DB: " + ty) diff --git a/examples/master/device_db.pyon b/examples/master/device_db.pyon index cafe5e538..effe4ef95 100644 --- a/examples/master/device_db.pyon +++ b/examples/master/device_db.pyon @@ -95,7 +95,6 @@ "best_effort": false, "host": "::1", "port": 4000, - "target_name": "pdq2", "command": "pdq2_controller -p {port} --bind {bind} --simulation --dump qc_q1_0.bin" }, "qc_q1_1": { @@ -103,7 +102,6 @@ "best_effort": false, "host": "::1", "port": 4001, - "target_name": "pdq2", "command": "pdq2_controller -p {port} --bind {bind} --simulation --dump qc_q1_1.bin" }, "qc_q1_2": { @@ -111,7 +109,6 @@ "best_effort": false, "host": "::1", "port": 4002, - "target_name": "pdq2", "command": "pdq2_controller -p {port} --bind {bind} --simulation --dump qc_q1_2.bin" }, "qc_q1_3": { @@ -119,7 +116,6 @@ "best_effort": false, "host": "::1", "port": 4003, - "target_name": "pdq2", "command": "pdq2_controller -p {port} --bind {bind} --simulation --dump qc_q1_3.bin" }, "electrodes": { @@ -138,7 +134,6 @@ "best_effort": true, "host": "::1", "port": 3253, - "target_name": "lda", "command": "lda_controller -p {port} --bind {bind} --simulation" },