mirror of https://github.com/m-labs/artiq.git
worker_impl: use DBHub as context manager
This commit is contained in:
parent
7b86138fd2
commit
43893c6c1d
|
@ -97,9 +97,8 @@ def main():
|
||||||
exp_inst = None
|
exp_inst = None
|
||||||
|
|
||||||
rdb = ResultDB(init_rt_results, update_rt_results)
|
rdb = ResultDB(init_rt_results, update_rt_results)
|
||||||
dbh = DBHub(ParentDDB, ParentPDB, rdb)
|
|
||||||
|
|
||||||
try:
|
with DBHub(ParentDDB, ParentPDB, rdb) as dbh:
|
||||||
while True:
|
while True:
|
||||||
obj = get_object()
|
obj = get_object()
|
||||||
action = obj["action"]
|
action = obj["action"]
|
||||||
|
@ -130,8 +129,6 @@ def main():
|
||||||
put_object({"action": "completed"})
|
put_object({"action": "completed"})
|
||||||
elif action == "terminate":
|
elif action == "terminate":
|
||||||
break
|
break
|
||||||
finally:
|
|
||||||
dbh.close_devices()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue