forked from M-Labs/artiq
worker_db: support read-only mode
This commit is contained in:
parent
fda4ee1a83
commit
ca89b6d0ed
@ -82,7 +82,7 @@ class AutoDB:
|
|||||||
raise KeyError("Device '{}' not found".format(k))
|
raise KeyError("Device '{}' not found".format(k))
|
||||||
object.__setattr__(self, k, dev)
|
object.__setattr__(self, k, dev)
|
||||||
self.build()
|
self.build()
|
||||||
if self.dbh is not None:
|
if self.dbh is not None and self.realtime_results:
|
||||||
self.dbh.add_rt_results(self.realtime_results)
|
self.dbh.add_rt_results(self.realtime_results)
|
||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
|
@ -84,13 +84,14 @@ def _create_device(desc, dbh):
|
|||||||
class DBHub:
|
class DBHub:
|
||||||
"""Connects device, parameter and result databases to experiment.
|
"""Connects device, parameter and result databases to experiment.
|
||||||
Handle device driver creation and destruction.
|
Handle device driver creation and destruction.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def __init__(self, ddb, pdb, rdb):
|
def __init__(self, ddb, pdb, rdb, read_only=False):
|
||||||
self.ddb = ddb
|
self.ddb = ddb
|
||||||
self.active_devices = OrderedDict()
|
self.active_devices = OrderedDict()
|
||||||
|
|
||||||
self.get_parameter = pdb.request
|
self.get_parameter = pdb.request
|
||||||
|
|
||||||
|
if not read_only:
|
||||||
self.set_parameter = pdb.set
|
self.set_parameter = pdb.set
|
||||||
self.add_rt_results = rdb.add_rt_results
|
self.add_rt_results = rdb.add_rt_results
|
||||||
self.get_result = rdb.request
|
self.get_result = rdb.request
|
||||||
|
Loading…
Reference in New Issue
Block a user