From 39dfbb41626190d195f04d8f063b7d38640b4dcd Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 12 Feb 2015 00:54:54 +0800 Subject: [PATCH] ddb: support for best effort RPC client --- artiq/master/db.py | 10 +++++++--- examples/ddb.pyon | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/artiq/master/db.py b/artiq/master/db.py index 7ee2735a8..2cad8b6f3 100644 --- a/artiq/master/db.py +++ b/artiq/master/db.py @@ -5,7 +5,7 @@ import numpy import h5py from artiq.protocols.sync_struct import Notifier -from artiq.protocols.pc_rpc import Client +from artiq.protocols.pc_rpc import Client, BestEffortClient _type_to_hdf5 = { @@ -79,7 +79,11 @@ def _create_device(desc, dbh): device_class = getattr(module, desc["class"]) return device_class(dbh, **desc["arguments"]) elif ty == "controller": - return Client(desc["host"], desc["port"], desc["target_name"]) + if desc["best_effort"]: + cl = BestEffortClient + else: + cl = Client + return cl(desc["host"], desc["port"], desc["target_name"]) else: raise ValueError("Unsupported type in device DB: " + ty) @@ -119,7 +123,7 @@ class DBHub: """ for dev in reversed(list(self.active_devices.values())): - if isinstance(dev, Client): + if isinstance(dev, (Client, BestEffortClient)): dev.close_rpc() elif hasattr(dev, "close"): dev.close() diff --git a/examples/ddb.pyon b/examples/ddb.pyon index 4f666f7db..b30796954 100644 --- a/examples/ddb.pyon +++ b/examples/ddb.pyon @@ -84,6 +84,7 @@ "lda": { "type": "controller", + "best_effort": true, "host": "::1", "port": 3253, "target_name": "lda",