From 848c86e8a4f4bb6d867f26c2a81633dbff409342 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 15 Apr 2016 01:13:53 +0800 Subject: [PATCH] master: group results by hour, not by minute --- RELEASE_NOTES.rst | 2 ++ artiq/master/worker_db.py | 20 +++++++++++--------- artiq/master/worker_impl.py | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index d154dbeb1..9ed10217b 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -32,6 +32,8 @@ unreleased [2.x] Please always include the console output when reporting a GUI crash. * Closing the core device communications before pausing is done automatically. Experiments no longer need to do it explicitly. +* The result folders are formatted "%Y-%m-%d/%H instead of "%Y-%m-%d/%H-%M". + (i.e. grouping by day and then by hour, instead of by day and then by minute) unreleased [1.0rc3] diff --git a/artiq/master/worker_db.py b/artiq/master/worker_db.py index ce0862b2b..bd34ef143 100644 --- a/artiq/master/worker_db.py +++ b/artiq/master/worker_db.py @@ -56,24 +56,26 @@ class RIDCounter: day_folders = os.listdir(self.results_dir) except: return r - day_folders = filter(lambda x: re.fullmatch('\d\d\d\d-\d\d-\d\d', x), - day_folders) + day_folders = filter( + lambda x: re.fullmatch("\\d\\d\\d\\d-\\d\\d-\\d\\d", x), + day_folders) for df in day_folders: day_path = os.path.join(self.results_dir, df) try: - minute_folders = os.listdir(day_path) + hm_folders = os.listdir(day_path) except: continue - minute_folders = filter(lambda x: re.fullmatch('\d\d-\d\d', x), - minute_folders) - for mf in minute_folders: - minute_path = os.path.join(day_path, mf) + hm_folders = filter(lambda x: re.fullmatch("\\d\\d(-\\d\\d)?", x), + hm_folders) + for hmf in hm_folders: + hm_path = os.path.join(day_path, hmf) try: - h5files = os.listdir(minute_path) + h5files = os.listdir(hm_path) except: continue for x in h5files: - m = re.fullmatch('(\d\d\d\d\d\d\d\d\d)-.*\.h5', x) + m = re.fullmatch( + "(\\d\\d\\d\\d\\d\\d\\d\\d\\d)-.*\\.h5", x) if m is None: continue rid = int(m.group(1)) diff --git a/artiq/master/worker_impl.py b/artiq/master/worker_impl.py index 4e6731ef7..79f71eba2 100644 --- a/artiq/master/worker_impl.py +++ b/artiq/master/worker_impl.py @@ -211,7 +211,7 @@ def main(): rid, obj["pipeline_name"], expid, obj["priority"]) dirname = os.path.join("results", time.strftime("%Y-%m-%d", start_time), - time.strftime("%H-%M", start_time)) + time.strftime("%H", start_time)) os.makedirs(dirname, exist_ok=True) os.chdir(dirname) exp_inst = exp(