forked from M-Labs/artiq
1
0
Fork 0

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.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
@ -34,10 +33,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("core")["arguments"]["host"]
mgmt = CommMgmt(core_addr)
try: try:
core_addr = device_mgr.get_desc("core")["arguments"]["host"]
mgmt = CommMgmt(device_mgr, core_addr)
if args.action == "reboot": if args.action == "reboot":
mgmt.reboot() mgmt.reboot()
elif args.action == "hotswap": elif args.action == "hotswap":
@ -46,7 +45,7 @@ def main():
print("An action needs to be specified.", file=sys.stderr) print("An action needs to be specified.", file=sys.stderr)
sys.exit(1) sys.exit(1)
finally: finally:
device_mgr.close_devices() mgmt.close()
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View File

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

View File

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