mirror of https://github.com/m-labs/artiq.git
artiq_corelog: cleanup
This commit is contained in:
parent
8cf0628435
commit
c83e15d040
|
@ -4,13 +4,12 @@ import argparse
|
||||||
|
|
||||||
from artiq.tools import verbosity_args, init_logger
|
from artiq.tools import verbosity_args, init_logger
|
||||||
from artiq.master.databases import DeviceDB
|
from artiq.master.databases import DeviceDB
|
||||||
from artiq.master.worker_db import DeviceManager
|
|
||||||
from artiq.coredevice.comm_mgmt import CommMgmt
|
from artiq.coredevice.comm_mgmt import CommMgmt
|
||||||
|
|
||||||
|
|
||||||
def get_argparser():
|
def get_argparser():
|
||||||
parser = argparse.ArgumentParser(description="ARTIQ core device "
|
parser = argparse.ArgumentParser(description="ARTIQ core device "
|
||||||
"log download tool")
|
"log tool")
|
||||||
verbosity_args(parser)
|
verbosity_args(parser)
|
||||||
parser.add_argument("--device-db", default="device_db.py",
|
parser.add_argument("--device-db", default="device_db.py",
|
||||||
help="device database file (default: '%(default)s')")
|
help="device database file (default: '%(default)s')")
|
||||||
|
@ -37,10 +36,10 @@ def get_argparser():
|
||||||
def main():
|
def main():
|
||||||
args = get_argparser().parse_args()
|
args = get_argparser().parse_args()
|
||||||
init_logger(args)
|
init_logger(args)
|
||||||
device_mgr = DeviceManager(DeviceDB(args.device_db))
|
|
||||||
|
core_addr = DeviceDB(args.device_db).get("comm")["arguments"]["host"]
|
||||||
|
mgmt = CommMgmt(None, core_addr)
|
||||||
try:
|
try:
|
||||||
core_addr = device_mgr.get_desc("comm")["arguments"]["host"]
|
|
||||||
mgmt = CommMgmt(device_mgr, core_addr)
|
|
||||||
if args.action == "set_level":
|
if args.action == "set_level":
|
||||||
mgmt.set_log_level(args.level)
|
mgmt.set_log_level(args.level)
|
||||||
elif args.action == "set_uart_level":
|
elif args.action == "set_uart_level":
|
||||||
|
@ -50,7 +49,7 @@ def main():
|
||||||
else:
|
else:
|
||||||
print(mgmt.get_log(), end="")
|
print(mgmt.get_log(), end="")
|
||||||
finally:
|
finally:
|
||||||
device_mgr.close_devices()
|
mgmt.close()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue