forked from M-Labs/artiq
get_ddb -> get_device_db
This commit is contained in:
parent
5c4ed7a9bd
commit
3cec176318
|
@ -74,12 +74,12 @@ def main():
|
|||
repo_backend = GitBackend(args.repository)
|
||||
else:
|
||||
repo_backend = FilesystemBackend(args.repository)
|
||||
repository = Repository(repo_backend, device_db.get_ddb, log.log)
|
||||
repository = Repository(repo_backend, device_db.get_device_db, log.log)
|
||||
atexit.register(repository.close)
|
||||
repository.scan_async()
|
||||
|
||||
worker_handlers = {
|
||||
"get_ddb": device_db.get_ddb,
|
||||
"get_device_db": device_db.get_device_db,
|
||||
"get_device": device_db.get,
|
||||
"get_dataset": dataset_db.get,
|
||||
"update_dataset": dataset_db.update,
|
||||
|
|
|
@ -186,11 +186,11 @@ class HasEnvironment:
|
|||
attribute are the same."""
|
||||
setattr(self, key, self.get_argument(key, processor, group))
|
||||
|
||||
def get_ddb(self):
|
||||
def get_device_db(self):
|
||||
"""Returns the full contents of the device database."""
|
||||
if self.__parent is not None:
|
||||
return self.__parent.get_ddb()
|
||||
return self.__device_mgr.get_ddb()
|
||||
return self.__parent.get_device_db()
|
||||
return self.__device_mgr.get_device_db()
|
||||
|
||||
def get_device(self, key):
|
||||
"""Creates and returns a device driver."""
|
||||
|
|
|
@ -20,7 +20,7 @@ class DeviceDB:
|
|||
if k not in self.data.read or self.data.read[k] != new_data[k]:
|
||||
self.data[k] = new_data[k]
|
||||
|
||||
def get_ddb(self):
|
||||
def get_device_db(self):
|
||||
return self.data.read
|
||||
|
||||
def get(self, key):
|
||||
|
|
|
@ -12,13 +12,13 @@ from artiq.tools import exc_to_warning
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def _scan_experiments(wd, get_ddb, log):
|
||||
async def _scan_experiments(wd, get_device_db, log):
|
||||
r = dict()
|
||||
for f in os.listdir(wd):
|
||||
if f.endswith(".py"):
|
||||
try:
|
||||
worker = Worker({
|
||||
"get_ddb": get_ddb,
|
||||
"get_device_db": get_device_db,
|
||||
"log": lambda message: log("scan", message)
|
||||
})
|
||||
try:
|
||||
|
@ -56,9 +56,9 @@ def _sync_explist(target, source):
|
|||
|
||||
|
||||
class Repository:
|
||||
def __init__(self, backend, get_ddb_fn, log_fn):
|
||||
def __init__(self, backend, get_device_db_fn, log_fn):
|
||||
self.backend = backend
|
||||
self.get_ddb_fn = get_ddb_fn
|
||||
self.get_device_db_fn = get_device_db_fn
|
||||
self.log_fn = log_fn
|
||||
|
||||
self.cur_rev = self.backend.get_head_rev()
|
||||
|
@ -81,7 +81,8 @@ class Repository:
|
|||
wd, _ = self.backend.request_rev(new_cur_rev)
|
||||
self.backend.release_rev(self.cur_rev)
|
||||
self.cur_rev = new_cur_rev
|
||||
new_explist = await _scan_experiments(wd, self.get_ddb_fn, self.log_fn)
|
||||
new_explist = await _scan_experiments(wd, self.get_device_db_fn,
|
||||
self.log_fn)
|
||||
|
||||
_sync_explist(self.explist, new_explist)
|
||||
finally:
|
||||
|
|
|
@ -39,9 +39,9 @@ class DeviceManager:
|
|||
self.virtual_devices = virtual_devices
|
||||
self.active_devices = OrderedDict()
|
||||
|
||||
def get_ddb(self):
|
||||
def get_device_db(self):
|
||||
"""Returns the full contents of the device database."""
|
||||
return self.ddb.get_ddb()
|
||||
return self.ddb.get_device_db()
|
||||
|
||||
def get(self, name):
|
||||
"""Get the device driver or controller client corresponding to a
|
||||
|
|
|
@ -63,7 +63,7 @@ class LogForwarder:
|
|||
|
||||
|
||||
class ParentDeviceDB:
|
||||
get_ddb = make_parent_action("get_ddb", "")
|
||||
get_device_db = make_parent_action("get_device_db", "")
|
||||
get = make_parent_action("get_device", "key", KeyError)
|
||||
|
||||
|
||||
|
@ -124,7 +124,7 @@ register_experiment = make_parent_action("register_experiment",
|
|||
|
||||
|
||||
class ExamineDeviceMgr:
|
||||
get_ddb = make_parent_action("get_ddb", "")
|
||||
get_device_db = make_parent_action("get_device_db", "")
|
||||
|
||||
def get(self, name):
|
||||
return None
|
||||
|
|
|
@ -8,8 +8,8 @@ class DDSSetter(EnvExperiment):
|
|||
def build(self):
|
||||
self.dds = dict()
|
||||
|
||||
ddb = self.get_ddb()
|
||||
for k, v in sorted(ddb.items(), key=itemgetter(0)):
|
||||
device_db = self.get_device_db()
|
||||
for k, v in sorted(device_db.items(), key=itemgetter(0)):
|
||||
if (isinstance(v, dict)
|
||||
and v["type"] == "local"
|
||||
and v["module"] == "artiq.coredevice.dds"
|
||||
|
|
Loading…
Reference in New Issue