From 3cec1763184be9002b5e2b17b6f6c41e21272226 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 12 Oct 2015 19:46:31 +0800 Subject: [PATCH] get_ddb -> get_device_db --- artiq/frontend/artiq_master.py | 4 ++-- artiq/language/environment.py | 6 +++--- artiq/master/databases.py | 2 +- artiq/master/repository.py | 11 ++++++----- artiq/master/worker_db.py | 4 ++-- artiq/master/worker_impl.py | 4 ++-- examples/master/repository/dds_setter.py | 4 ++-- 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/artiq/frontend/artiq_master.py b/artiq/frontend/artiq_master.py index 264658ef9..9a10e8c57 100755 --- a/artiq/frontend/artiq_master.py +++ b/artiq/frontend/artiq_master.py @@ -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, diff --git a/artiq/language/environment.py b/artiq/language/environment.py index 4801720f7..7f378e092 100644 --- a/artiq/language/environment.py +++ b/artiq/language/environment.py @@ -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.""" diff --git a/artiq/master/databases.py b/artiq/master/databases.py index acbf1a37a..40549683c 100644 --- a/artiq/master/databases.py +++ b/artiq/master/databases.py @@ -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): diff --git a/artiq/master/repository.py b/artiq/master/repository.py index c8024104d..f060fee87 100644 --- a/artiq/master/repository.py +++ b/artiq/master/repository.py @@ -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: diff --git a/artiq/master/worker_db.py b/artiq/master/worker_db.py index f36371a1f..b9f76bae0 100644 --- a/artiq/master/worker_db.py +++ b/artiq/master/worker_db.py @@ -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 diff --git a/artiq/master/worker_impl.py b/artiq/master/worker_impl.py index ff9a58a4c..ad18d9149 100644 --- a/artiq/master/worker_impl.py +++ b/artiq/master/worker_impl.py @@ -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 diff --git a/examples/master/repository/dds_setter.py b/examples/master/repository/dds_setter.py index ebcd72bc1..1e35496d8 100644 --- a/examples/master/repository/dds_setter.py +++ b/examples/master/repository/dds_setter.py @@ -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"