device_db: make target_name parameter optional for controllers

This commit is contained in:
Sebastien Bourdeauducq 2015-10-18 14:35:49 +08:00
parent 5947f54855
commit a5606768ad
2 changed files with 8 additions and 8 deletions

View File

@ -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)

View File

@ -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"
},