diff --git a/.gitignore b/.gitignore index c6c1c6102..b7de79247 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ doc/manual/_build /dist /*.egg-info /.coverage +examples/results diff --git a/artiq/master/worker_impl.py b/artiq/master/worker_impl.py index 62c9bce60..52784f67c 100644 --- a/artiq/master/worker_impl.py +++ b/artiq/master/worker_impl.py @@ -1,4 +1,6 @@ import sys +import os +import time from inspect import isclass import traceback @@ -80,6 +82,7 @@ def get_unit(file, unit): def run(rid, run_params): + start_time = time.localtime() unit = get_unit(run_params["file"], run_params["unit"]) realtime_results = unit.realtime_results() @@ -115,8 +118,12 @@ def run(rid, run_params): finally: dbh.close() - filename = "{:05}-{}.h5".format(rid, unit.__name__) - f = h5py.File(filename, "w") + dirname = os.path.join("results", + time.strftime("%y-%m-%d", start_time), + time.strftime("%H-%M", start_time)) + filename = "{:09}-{}.h5".format(rid, unit.__name__) + os.makedirs(dirname, exist_ok=True) + f = h5py.File(os.path.join(dirname, filename), "w") try: rdb.write_hdf5(f) finally: