2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 03:08:27 +08:00

fix usage of CommMgmt

This commit is contained in:
Sebastien Bourdeauducq 2017-05-22 17:32:11 +08:00
parent d8eff2aa4e
commit 5fc953119e
3 changed files with 7 additions and 8 deletions

View File

@ -6,7 +6,6 @@ import struct
from artiq.tools import verbosity_args, init_logger
from artiq.master.databases import DeviceDB
from artiq.master.worker_db import DeviceManager
from artiq.coredevice.comm_mgmt import CommMgmt
@ -34,10 +33,10 @@ def get_argparser():
def main():
args = get_argparser().parse_args()
init_logger(args)
device_mgr = DeviceManager(DeviceDB(args.device_db))
core_addr = DeviceDB(args.device_db).get("core")["arguments"]["host"]
mgmt = CommMgmt(core_addr)
try:
core_addr = device_mgr.get_desc("core")["arguments"]["host"]
mgmt = CommMgmt(device_mgr, core_addr)
if args.action == "reboot":
mgmt.reboot()
elif args.action == "hotswap":
@ -46,7 +45,7 @@ def main():
print("An action needs to be specified.", file=sys.stderr)
sys.exit(1)
finally:
device_mgr.close_devices()
mgmt.close()
if __name__ == "__main__":
main()

View File

@ -38,7 +38,7 @@ def main():
init_logger(args)
core_addr = DeviceDB(args.device_db).get("core")["arguments"]["host"]
mgmt = CommMgmt(None, core_addr)
mgmt = CommMgmt(core_addr)
try:
if args.action == "set_level":
mgmt.set_log_level(args.level)

View File

@ -403,7 +403,7 @@ class CoredeviceTest(ExperimentCase):
def test_collision(self):
core_addr = self.device_mgr.get_desc("core")["arguments"]["host"]
mgmt = CommMgmt(self.device_mgr, core_addr)
mgmt = CommMgmt(core_addr)
mgmt.clear_log()
self.execute(Collision)
log = mgmt.get_log()
@ -412,7 +412,7 @@ class CoredeviceTest(ExperimentCase):
def test_address_collision(self):
core_addr = self.device_mgr.get_desc("core")["arguments"]["host"]
mgmt = CommMgmt(self.device_mgr, core_addr)
mgmt = CommMgmt(core_addr)
mgmt.clear_log()
self.execute(AddressCollision)
log = mgmt.get_log()