master: use epoch time for timestamps (closes #726)

This commit is contained in:
Chris Ballance 2017-08-03 10:27:16 +01:00
parent 2998372d08
commit 223501f811
1 changed files with 7 additions and 6 deletions

View File

@ -242,7 +242,7 @@ def main():
obj = get_object() obj = get_object()
action = obj["action"] action = obj["action"]
if action == "build": if action == "build":
start_time = time.localtime() start_time = time.time()
rid = obj["rid"] rid = obj["rid"]
expid = obj["expid"] expid = obj["expid"]
if obj["wd"] is not None: if obj["wd"] is not None:
@ -256,9 +256,10 @@ def main():
exp = get_exp(experiment_file, expid["class_name"]) exp = get_exp(experiment_file, expid["class_name"])
device_mgr.virtual_devices["scheduler"].set_run_info( device_mgr.virtual_devices["scheduler"].set_run_info(
rid, obj["pipeline_name"], expid, obj["priority"]) rid, obj["pipeline_name"], expid, obj["priority"])
start_local_time = time.localtime(start_time)
dirname = os.path.join("results", dirname = os.path.join("results",
time.strftime("%Y-%m-%d", start_time), time.strftime("%Y-%m-%d", start_local_time),
time.strftime("%H", start_time)) time.strftime("%H", start_local_time))
os.makedirs(dirname, exist_ok=True) os.makedirs(dirname, exist_ok=True)
os.chdir(dirname) os.chdir(dirname)
argument_mgr = ProcessArgumentManager(expid["arguments"]) argument_mgr = ProcessArgumentManager(expid["arguments"])
@ -268,7 +269,7 @@ def main():
exp_inst.prepare() exp_inst.prepare()
put_object({"action": "completed"}) put_object({"action": "completed"})
elif action == "run": elif action == "run":
run_time = time.localtime() run_time = time.time()
exp_inst.run() exp_inst.run()
put_object({"action": "completed"}) put_object({"action": "completed"})
elif action == "analyze": elif action == "analyze":
@ -286,8 +287,8 @@ def main():
dataset_mgr.write_hdf5(f) dataset_mgr.write_hdf5(f)
f["artiq_version"] = artiq_version f["artiq_version"] = artiq_version
f["rid"] = rid f["rid"] = rid
f["start_time"] = int(time.mktime(start_time)) f["start_time"] = int(start_time)
f["run_time"] = int(time.mktime(run_time)) f["run_time"] = int(run_time)
f["expid"] = pyon.encode(expid) f["expid"] = pyon.encode(expid)
put_object({"action": "completed"}) put_object({"action": "completed"})
elif action == "examine": elif action == "examine":