compile,coretool: use new dataset API

This commit is contained in:
Sebastien Bourdeauducq 2015-10-12 19:32:16 +08:00
parent a754d4b5f5
commit b51910fa42
2 changed files with 16 additions and 16 deletions

View File

@ -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")

View File

@ -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()