From 223501f811ccd95dca2acdb8449306a5098d5a7c Mon Sep 17 00:00:00 2001 From: Chris Ballance Date: Thu, 3 Aug 2017 10:27:16 +0100 Subject: [PATCH 1/2] master: use epoch time for timestamps (closes #726) --- artiq/master/worker_impl.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/artiq/master/worker_impl.py b/artiq/master/worker_impl.py index 7294ee462..fb7e4831c 100644 --- a/artiq/master/worker_impl.py +++ b/artiq/master/worker_impl.py @@ -242,7 +242,7 @@ def main(): obj = get_object() action = obj["action"] if action == "build": - start_time = time.localtime() + start_time = time.time() rid = obj["rid"] expid = obj["expid"] if obj["wd"] is not None: @@ -256,9 +256,10 @@ def main(): exp = get_exp(experiment_file, expid["class_name"]) device_mgr.virtual_devices["scheduler"].set_run_info( rid, obj["pipeline_name"], expid, obj["priority"]) + start_local_time = time.localtime(start_time) dirname = os.path.join("results", - time.strftime("%Y-%m-%d", start_time), - time.strftime("%H", start_time)) + time.strftime("%Y-%m-%d", start_local_time), + time.strftime("%H", start_local_time)) os.makedirs(dirname, exist_ok=True) os.chdir(dirname) argument_mgr = ProcessArgumentManager(expid["arguments"]) @@ -268,7 +269,7 @@ def main(): exp_inst.prepare() put_object({"action": "completed"}) elif action == "run": - run_time = time.localtime() + run_time = time.time() exp_inst.run() put_object({"action": "completed"}) elif action == "analyze": @@ -286,8 +287,8 @@ def main(): dataset_mgr.write_hdf5(f) f["artiq_version"] = artiq_version f["rid"] = rid - f["start_time"] = int(time.mktime(start_time)) - f["run_time"] = int(time.mktime(run_time)) + f["start_time"] = int(start_time) + f["run_time"] = int(run_time) f["expid"] = pyon.encode(expid) put_object({"action": "completed"}) elif action == "examine": From cc289dd3a0bd0c0ba3bc13f692af127de0828987 Mon Sep 17 00:00:00 2001 From: Chris Ballance Date: Thu, 3 Aug 2017 10:41:57 +0100 Subject: [PATCH 2/2] master: store run_time and start_time as doubles --- RELEASE_NOTES.rst | 2 ++ artiq/master/worker_impl.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index 0f4327e01..9f2784c03 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -51,6 +51,8 @@ Release notes * The PDQ(2/3) driver has been removed and is now being maintained out-of tree at https://github.com/m-labs/pdq. All SPI/USB driver layers, Mediator, CompoundPDQ and examples/documentation has been moved. +* The results keys start_time and run_time are now stored as doubles, rather + than ints. 2.4 diff --git a/artiq/master/worker_impl.py b/artiq/master/worker_impl.py index fb7e4831c..3d6153603 100644 --- a/artiq/master/worker_impl.py +++ b/artiq/master/worker_impl.py @@ -287,8 +287,8 @@ def main(): dataset_mgr.write_hdf5(f) f["artiq_version"] = artiq_version f["rid"] = rid - f["start_time"] = int(start_time) - f["run_time"] = int(run_time) + f["start_time"] = start_time + f["run_time"] = run_time f["expid"] = pyon.encode(expid) put_object({"action": "completed"}) elif action == "examine":