From 43893c6c1d7ac07105ecf828b20c2fc30d93ceba Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Sat, 4 Apr 2015 20:41:09 -0600 Subject: [PATCH] worker_impl: use DBHub as context manager --- artiq/master/worker_impl.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/artiq/master/worker_impl.py b/artiq/master/worker_impl.py index 9b3e593f6..6475fca9a 100644 --- a/artiq/master/worker_impl.py +++ b/artiq/master/worker_impl.py @@ -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()