mirror of https://github.com/m-labs/artiq.git
compile,coretool: use new dataset API
This commit is contained in:
parent
a754d4b5f5
commit
b51910fa42
|
@ -3,8 +3,8 @@
|
||||||
import logging
|
import logging
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from artiq.protocols.pyon import FlatFileDB
|
from artiq.master.databases import DeviceDB, DatasetDB
|
||||||
from artiq.master.worker_db import DeviceManager
|
from artiq.master.worker_db import DeviceManager, DatasetManager
|
||||||
from artiq.tools import *
|
from artiq.tools import *
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,10 +15,10 @@ def get_argparser():
|
||||||
parser = argparse.ArgumentParser(description="ARTIQ static compiler")
|
parser = argparse.ArgumentParser(description="ARTIQ static compiler")
|
||||||
|
|
||||||
verbosity_args(parser)
|
verbosity_args(parser)
|
||||||
parser.add_argument("-d", "--ddb", default="ddb.pyon",
|
parser.add_argument("--device-db", default="device_db.pyon",
|
||||||
help="device database file")
|
help="device database file (default: '%(default)s')")
|
||||||
parser.add_argument("-p", "--pdb", default="pdb.pyon",
|
parser.add_argument("--dataset-db", default="dataset_db.pyon",
|
||||||
help="parameter database file")
|
help="dataset file (default: '%(default)s')")
|
||||||
|
|
||||||
parser.add_argument("-e", "--experiment", default=None,
|
parser.add_argument("-e", "--experiment", default=None,
|
||||||
help="experiment to compile")
|
help="experiment to compile")
|
||||||
|
@ -36,14 +36,14 @@ def main():
|
||||||
args = get_argparser().parse_args()
|
args = get_argparser().parse_args()
|
||||||
init_logger(args)
|
init_logger(args)
|
||||||
|
|
||||||
dmgr = DeviceManager(FlatFileDB(args.ddb))
|
device_mgr = DeviceManager(DeviceDB(args.device_db))
|
||||||
pdb = FlatFileDB(args.pdb)
|
dataset_mgr = DatasetManager(DatasetDB(args.dataset_db))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
module = file_import(args.file)
|
module = file_import(args.file)
|
||||||
exp = get_experiment(module, args.experiment)
|
exp = get_experiment(module, args.experiment)
|
||||||
arguments = parse_arguments(args.arguments)
|
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")
|
if (not hasattr(exp.run, "k_function_info")
|
||||||
or not exp.run.k_function_info):
|
or not exp.run.k_function_info):
|
||||||
|
@ -55,7 +55,7 @@ def main():
|
||||||
[exp_inst], {},
|
[exp_inst], {},
|
||||||
with_attr_writeback=False)
|
with_attr_writeback=False)
|
||||||
finally:
|
finally:
|
||||||
dmgr.close_devices()
|
device_mgr.close_devices()
|
||||||
|
|
||||||
if rpc_map:
|
if rpc_map:
|
||||||
raise ValueError("Experiment must not use RPC")
|
raise ValueError("Experiment must not use RPC")
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
|
from artiq.master.databases import DeviceDB
|
||||||
from artiq.master.worker_db import DeviceManager
|
from artiq.master.worker_db import DeviceManager
|
||||||
from artiq.protocols.file_db import FlatFileDB
|
|
||||||
|
|
||||||
|
|
||||||
def to_bytes(string):
|
def to_bytes(string):
|
||||||
|
@ -13,8 +13,8 @@ def to_bytes(string):
|
||||||
def get_argparser():
|
def get_argparser():
|
||||||
parser = argparse.ArgumentParser(description="ARTIQ core device "
|
parser = argparse.ArgumentParser(description="ARTIQ core device "
|
||||||
"remote access tool")
|
"remote access tool")
|
||||||
parser.add_argument("--ddb", default="ddb.pyon",
|
parser.add_argument("--device-db", default="device_db.pyon",
|
||||||
help="device database file")
|
help="device database file (default: '%(default)s')")
|
||||||
|
|
||||||
subparsers = parser.add_subparsers(dest="action")
|
subparsers = parser.add_subparsers(dest="action")
|
||||||
subparsers.required = True
|
subparsers.required = True
|
||||||
|
@ -58,9 +58,9 @@ def get_argparser():
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = get_argparser().parse_args()
|
args = get_argparser().parse_args()
|
||||||
dmgr = DeviceManager(FlatFileDB(args.ddb))
|
device_mgr = DeviceManager(DeviceDB(args.device_db))
|
||||||
try:
|
try:
|
||||||
comm = dmgr.get("comm")
|
comm = device_mgr.get("comm")
|
||||||
|
|
||||||
if args.action == "log":
|
if args.action == "log":
|
||||||
print(comm.get_log())
|
print(comm.get_log())
|
||||||
|
@ -82,7 +82,7 @@ def main():
|
||||||
elif args.action == "cfg-erase":
|
elif args.action == "cfg-erase":
|
||||||
comm.flash_storage_erase()
|
comm.flash_storage_erase()
|
||||||
finally:
|
finally:
|
||||||
dmgr.close_devices()
|
device_mgr.close_devices()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue