From b51910fa42c31bfca18bb3ccd425727310479905 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 12 Oct 2015 19:32:16 +0800 Subject: [PATCH] compile,coretool: use new dataset API --- artiq/frontend/artiq_compile.py | 20 ++++++++++---------- artiq/frontend/artiq_coretool.py | 12 ++++++------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/artiq/frontend/artiq_compile.py b/artiq/frontend/artiq_compile.py index a058a298a..e55b7ee1b 100755 --- a/artiq/frontend/artiq_compile.py +++ b/artiq/frontend/artiq_compile.py @@ -3,8 +3,8 @@ import logging import argparse -from artiq.protocols.pyon import FlatFileDB -from artiq.master.worker_db import DeviceManager +from artiq.master.databases import DeviceDB, DatasetDB +from artiq.master.worker_db import DeviceManager, DatasetManager from artiq.tools import * @@ -15,10 +15,10 @@ def get_argparser(): parser = argparse.ArgumentParser(description="ARTIQ static compiler") verbosity_args(parser) - parser.add_argument("-d", "--ddb", default="ddb.pyon", - help="device database file") - parser.add_argument("-p", "--pdb", default="pdb.pyon", - help="parameter database file") + parser.add_argument("--device-db", default="device_db.pyon", + help="device database file (default: '%(default)s')") + parser.add_argument("--dataset-db", default="dataset_db.pyon", + help="dataset file (default: '%(default)s')") parser.add_argument("-e", "--experiment", default=None, help="experiment to compile") @@ -36,14 +36,14 @@ def main(): args = get_argparser().parse_args() init_logger(args) - dmgr = DeviceManager(FlatFileDB(args.ddb)) - pdb = FlatFileDB(args.pdb) + device_mgr = DeviceManager(DeviceDB(args.device_db)) + dataset_mgr = DatasetManager(DatasetDB(args.dataset_db)) try: module = file_import(args.file) exp = get_experiment(module, args.experiment) arguments = parse_arguments(args.arguments) - exp_inst = exp(dmgr, pdb, **arguments) + exp_inst = exp(device_mgr, dataset_mgr, **arguments) if (not hasattr(exp.run, "k_function_info") or not exp.run.k_function_info): @@ -55,7 +55,7 @@ def main(): [exp_inst], {}, with_attr_writeback=False) finally: - dmgr.close_devices() + device_mgr.close_devices() if rpc_map: raise ValueError("Experiment must not use RPC") diff --git a/artiq/frontend/artiq_coretool.py b/artiq/frontend/artiq_coretool.py index 41649f03e..0574c53c1 100755 --- a/artiq/frontend/artiq_coretool.py +++ b/artiq/frontend/artiq_coretool.py @@ -2,8 +2,8 @@ import argparse +from artiq.master.databases import DeviceDB from artiq.master.worker_db import DeviceManager -from artiq.protocols.file_db import FlatFileDB def to_bytes(string): @@ -13,8 +13,8 @@ def to_bytes(string): def get_argparser(): parser = argparse.ArgumentParser(description="ARTIQ core device " "remote access tool") - parser.add_argument("--ddb", default="ddb.pyon", - help="device database file") + parser.add_argument("--device-db", default="device_db.pyon", + help="device database file (default: '%(default)s')") subparsers = parser.add_subparsers(dest="action") subparsers.required = True @@ -58,9 +58,9 @@ def get_argparser(): def main(): args = get_argparser().parse_args() - dmgr = DeviceManager(FlatFileDB(args.ddb)) + device_mgr = DeviceManager(DeviceDB(args.device_db)) try: - comm = dmgr.get("comm") + comm = device_mgr.get("comm") if args.action == "log": print(comm.get_log()) @@ -82,7 +82,7 @@ def main(): elif args.action == "cfg-erase": comm.flash_storage_erase() finally: - dmgr.close_devices() + device_mgr.close_devices() if __name__ == "__main__": main()