forked from M-Labs/artiq
master: use RID + unit class name for HDF5 filenames
This commit is contained in:
parent
65555a3a09
commit
cc172699ea
|
@ -67,7 +67,7 @@ class Scheduler:
|
||||||
def _run(self, rid, run_params):
|
def _run(self, rid, run_params):
|
||||||
self.run_cb(rid, run_params)
|
self.run_cb(rid, run_params)
|
||||||
try:
|
try:
|
||||||
yield from self.worker.run(run_params)
|
yield from self.worker.run(rid, run_params)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("RID {} failed:".format(rid))
|
print("RID {} failed:".format(rid))
|
||||||
print(e)
|
print(e)
|
||||||
|
|
|
@ -60,8 +60,9 @@ class Worker:
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def run(self, run_params):
|
def run(self, rid, run_params):
|
||||||
yield from self._send(run_params, self.send_timeout)
|
obj = {"rid": rid, "run_params": run_params}
|
||||||
|
yield from self._send(obj, self.send_timeout)
|
||||||
obj = yield from self._recv(self.start_reply_timeout)
|
obj = yield from self._recv(self.start_reply_timeout)
|
||||||
if obj != "ack":
|
if obj != "ack":
|
||||||
raise WorkerFailed("Incorrect acknowledgement")
|
raise WorkerFailed("Incorrect acknowledgement")
|
||||||
|
|
|
@ -79,7 +79,7 @@ def get_unit(file, unit):
|
||||||
return getattr(module, unit)
|
return getattr(module, unit)
|
||||||
|
|
||||||
|
|
||||||
def run(run_params):
|
def run(rid, run_params):
|
||||||
unit = get_unit(run_params["file"], run_params["unit"])
|
unit = get_unit(run_params["file"], run_params["unit"])
|
||||||
|
|
||||||
realtime_results = unit.realtime_results()
|
realtime_results = unit.realtime_results()
|
||||||
|
@ -115,7 +115,7 @@ def run(run_params):
|
||||||
finally:
|
finally:
|
||||||
dbh.close()
|
dbh.close()
|
||||||
|
|
||||||
filename = run_params["file"] + ".h5"
|
filename = "{:05}-{}.h5".format(rid, unit.__name__)
|
||||||
f = h5py.File(filename, "w")
|
f = h5py.File(filename, "w")
|
||||||
try:
|
try:
|
||||||
rdb.write_hdf5(f)
|
rdb.write_hdf5(f)
|
||||||
|
@ -129,7 +129,7 @@ def main():
|
||||||
while True:
|
while True:
|
||||||
obj = get_object()
|
obj = get_object()
|
||||||
put_object("ack")
|
put_object("ack")
|
||||||
run(obj)
|
run(obj["rid"], obj["run_params"])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue