forked from M-Labs/artiq
worker: close devices immediately after run and before analyze
This commit is contained in:
parent
577754c38f
commit
200e20fb39
@ -178,7 +178,7 @@ def main():
|
||||
key=itemgetter(0)):
|
||||
print("{}: {}".format(k, v))
|
||||
finally:
|
||||
dbh.close()
|
||||
dbh.close_devices()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@ -104,16 +104,12 @@ class DBHub:
|
||||
self.active_devices[name] = dev
|
||||
return dev
|
||||
|
||||
def close(self):
|
||||
def close_devices(self):
|
||||
"""Closes all active devices, in the opposite order as they were
|
||||
requested.
|
||||
|
||||
Do not use the same ``DBHub`` again after calling
|
||||
this function.
|
||||
|
||||
"""
|
||||
requested."""
|
||||
for dev in reversed(list(self.active_devices.values())):
|
||||
if isinstance(dev, (Client, BestEffortClient)):
|
||||
dev.close_rpc()
|
||||
elif hasattr(dev, "close"):
|
||||
dev.close()
|
||||
self.active_devices = OrderedDict()
|
||||
|
@ -116,6 +116,7 @@ def main():
|
||||
put_object({"action": "completed"})
|
||||
elif action == "run":
|
||||
exp_inst.run()
|
||||
dbh.close_devices()
|
||||
put_object({"action": "completed"})
|
||||
elif action == "analyze":
|
||||
exp_inst.analyze()
|
||||
@ -130,7 +131,7 @@ def main():
|
||||
elif action == "terminate":
|
||||
break
|
||||
finally:
|
||||
dbh.close()
|
||||
dbh.close_devices()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user