master: use RID + unit class name for HDF5 filenames

This commit is contained in:
Sebastien Bourdeauducq 2015-02-20 14:11:55 -07:00
parent 65555a3a09
commit cc172699ea
3 changed files with 7 additions and 6 deletions

View File

@ -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)

View File

@ -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")

View File

@ -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()