forked from M-Labs/artiq
1
0
Fork 0

Merge pull request #809 from cjbe/epoch_time

master: use epoch time for timestamps (closes #726)
This commit is contained in:
Robert Jördens 2017-08-03 12:55:23 +02:00 committed by GitHub
commit bc2d9ef818
2 changed files with 9 additions and 6 deletions

View File

@ -52,6 +52,8 @@ Release notes
at https://github.com/m-labs/pdq. All SPI/USB driver layers, Mediator, at https://github.com/m-labs/pdq. All SPI/USB driver layers, Mediator,
CompoundPDQ and examples/documentation has been moved. CompoundPDQ and examples/documentation has been moved.
* The master now rotates log files at midnight, rather than based on log size. * The master now rotates log files at midnight, rather than based on log size.
* The results keys start_time and run_time are now stored as doubles of UNIX time,
rather than ints of local time.
2.4 2.4

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"] = start_time
f["run_time"] = int(time.mktime(run_time)) f["run_time"] = 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":