From 1aec6a0462984508d256aa39dac2ce336583db07 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 21 Feb 2015 13:42:26 -0700 Subject: [PATCH] master: name results 'year-month-day/hour-minute/runid-experiment' --- .gitignore | 1 + artiq/master/worker_impl.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) 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: