worker_impl: use DBHub as context manager

This commit is contained in:
Robert Jördens 2015-04-04 20:41:09 -06:00
parent 7b86138fd2
commit 43893c6c1d

View File

@ -97,9 +97,8 @@ def main():
exp_inst = None
rdb = ResultDB(init_rt_results, update_rt_results)
dbh = DBHub(ParentDDB, ParentPDB, rdb)
try:
with DBHub(ParentDDB, ParentPDB, rdb) as dbh:
while True:
obj = get_object()
action = obj["action"]
@ -130,8 +129,6 @@ def main():
put_object({"action": "completed"})
elif action == "terminate":
break
finally:
dbh.close_devices()
if __name__ == "__main__":
main()