From cc172699ea912a99f005bc7181ced677ea1983ba Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 20 Feb 2015 14:11:55 -0700 Subject: [PATCH] master: use RID + unit class name for HDF5 filenames --- artiq/master/scheduler.py | 2 +- artiq/master/worker.py | 5 +++-- artiq/master/worker_impl.py | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/artiq/master/scheduler.py b/artiq/master/scheduler.py index cd007d0ed..00e67226a 100644 --- a/artiq/master/scheduler.py +++ b/artiq/master/scheduler.py @@ -67,7 +67,7 @@ class Scheduler: def _run(self, rid, run_params): self.run_cb(rid, run_params) try: - yield from self.worker.run(run_params) + yield from self.worker.run(rid, run_params) except Exception as e: print("RID {} failed:".format(rid)) print(e) diff --git a/artiq/master/worker.py b/artiq/master/worker.py index fedcd6ebc..d42626212 100644 --- a/artiq/master/worker.py +++ b/artiq/master/worker.py @@ -60,8 +60,9 @@ class Worker: return obj @asyncio.coroutine - def run(self, run_params): - yield from self._send(run_params, self.send_timeout) + def run(self, rid, run_params): + obj = {"rid": rid, "run_params": run_params} + yield from self._send(obj, self.send_timeout) obj = yield from self._recv(self.start_reply_timeout) if obj != "ack": raise WorkerFailed("Incorrect acknowledgement") diff --git a/artiq/master/worker_impl.py b/artiq/master/worker_impl.py index d9959e760..62c9bce60 100644 --- a/artiq/master/worker_impl.py +++ b/artiq/master/worker_impl.py @@ -79,7 +79,7 @@ def get_unit(file, unit): return getattr(module, unit) -def run(run_params): +def run(rid, run_params): unit = get_unit(run_params["file"], run_params["unit"]) realtime_results = unit.realtime_results() @@ -115,7 +115,7 @@ def run(run_params): finally: dbh.close() - filename = run_params["file"] + ".h5" + filename = "{:05}-{}.h5".format(rid, unit.__name__) f = h5py.File(filename, "w") try: rdb.write_hdf5(f) @@ -129,7 +129,7 @@ def main(): while True: obj = get_object() put_object("ack") - run(obj) + run(obj["rid"], obj["run_params"]) if __name__ == "__main__": main()