From 5b955e8ce81f76582ee0d8daa285612403e2a807 Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Thu, 7 Apr 2016 23:04:23 +0800 Subject: [PATCH] worker_db: factor get_output_prefix() --- artiq/master/worker_db.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/artiq/master/worker_db.py b/artiq/master/worker_db.py index 5e58ceaf2..99db89d6a 100644 --- a/artiq/master/worker_db.py +++ b/artiq/master/worker_db.py @@ -148,13 +148,18 @@ class DeviceManager: self.active_devices.clear() -def get_hdf5_output(start_time, rid, name): +def get_output_prefix(start_time, rid, name): dirname = os.path.join("results", time.strftime("%Y-%m-%d", start_time), time.strftime("%H-%M", start_time)) - filename = "{:09}-{}.h5".format(rid, name) + filename = "{:09}-{}".format(rid, name) os.makedirs(dirname, exist_ok=True) - return h5py.File(os.path.join(dirname, filename), "w") + return os.path.join(dirname, filename) + + +def get_hdf5_output(start_time, rid, name): + prefix = get_output_prefix(start_time, rid, name) + return h5py.File("{}.h5".format(prefix), "w") class DatasetManager: