Skip to content
Snippets Groups Projects
Commit c9f2f3d2 authored by Thomas Kluyver's avatar Thomas Kluyver
Browse files

Use fractional seconds in timestamps from webservice

parent fe43ab03
No related branches found
No related tags found
1 merge request!871Make metadata directory name match report filename
...@@ -956,7 +956,7 @@ class ActionsServer: ...@@ -956,7 +956,7 @@ class ActionsServer:
This will trigger a correction process to be launched for that run in This will trigger a correction process to be launched for that run in
the given cycle and proposal. the given cycle and proposal.
""" """
request_time = datetime.now().strftime('%Y-%m-%dT%H:%M:%S') request_time = datetime.now()
try: try:
runnr = runnr.strip('r') runnr = runnr.strip('r')
...@@ -970,9 +970,9 @@ class ActionsServer: ...@@ -970,9 +970,9 @@ class ActionsServer:
return msg.encode() return msg.encode()
with time_db_transaction(self.job_db, 'Insert request'): with time_db_transaction(self.job_db, 'Insert request'):
cur = self.job_db.execute( # 2 cur = self.job_db.execute(
"INSERT INTO requests VALUES (NULL, ?, ?, ?, 'CORRECT', ?)", "INSERT INTO requests VALUES (NULL, ?, ?, ?, 'CORRECT', ?)",
(rid, proposal, int(runnr), request_time) (rid, proposal, int(runnr), request_time.isoformat())
) )
req_id = cur.lastrowid req_id = cur.lastrowid
...@@ -1105,7 +1105,7 @@ class ActionsServer: ...@@ -1105,7 +1105,7 @@ class ActionsServer:
with time_db_transaction(self.job_db, 'Insert request'): with time_db_transaction(self.job_db, 'Insert request'):
cur = self.job_db.execute( cur = self.job_db.execute(
"INSERT INTO requests VALUES (NULL, ?, ?, ?, 'CORRECT', ?)", "INSERT INTO requests VALUES (NULL, ?, ?, ?, 'CORRECT', ?)",
(rid, proposal, int(runnr), request_time.strftime('%Y-%m-%dT%H:%M:%S')) (rid, proposal, int(runnr), request_time.isoformat())
) )
req_id = cur.lastrowid req_id = cur.lastrowid
...@@ -1170,7 +1170,7 @@ class ActionsServer: ...@@ -1170,7 +1170,7 @@ class ActionsServer:
'--env-cache', '--env-cache',
f'/gpfs/exfel/data/scratch/{getuser()}/calib-repeat-envs', f'/gpfs/exfel/data/scratch/{getuser()}/calib-repeat-envs',
'--report-to', '--report-to',
f'{reports_dir}/{karabo_id}_RECORRECT_{request_time:%y%m%d_%H%M%S}' f'{reports_dir}/{karabo_id}_RECORRECT_{request_time:%y%m%d_%H%M%S.%f}'
] ]
with time_db_transaction(self.job_db, 'Insert execution'): with time_db_transaction(self.job_db, 'Insert execution'):
...@@ -1216,7 +1216,7 @@ class ActionsServer: ...@@ -1216,7 +1216,7 @@ class ActionsServer:
:param runnr: is the run number in integer form, i.e. without leading :param runnr: is the run number in integer form, i.e. without leading
"r" "r"
""" """
request_time = datetime.now().strftime('%Y-%m-%dT%H:%M:%S') request_time = datetime.now()
try: try:
pdus, karabo_das, wait_runs = ast.literal_eval(','.join(extra)) pdus, karabo_das, wait_runs = ast.literal_eval(','.join(extra))
...@@ -1236,7 +1236,7 @@ class ActionsServer: ...@@ -1236,7 +1236,7 @@ class ActionsServer:
with time_db_transaction(self.job_db, 'Insert request'): with time_db_transaction(self.job_db, 'Insert request'):
cur = self.job_db.execute( cur = self.job_db.execute(
"INSERT INTO requests VALUES (NULL, ?, ?, ?, 'DARK', ?)", "INSERT INTO requests VALUES (NULL, ?, ?, ?, 'DARK', ?)",
(rid, proposal, int(wait_runs[-1]), request_time) (rid, proposal, int(wait_runs[-1]), request_time.isoformat())
) )
req_id = cur.lastrowid req_id = cur.lastrowid
...@@ -1445,9 +1445,9 @@ class ActionsServer: ...@@ -1445,9 +1445,9 @@ class ActionsServer:
action=action, instrument=instrument, action=action, instrument=instrument,
cycle=cycle, proposal=proposal, cycle=cycle, proposal=proposal,
runs="_".join([f"r{r}" for r in run_nrs]), runs="_".join([f"r{r}" for r in run_nrs]),
time_stamp=datetime.now().strftime('%y%m%d_%H%M%S'), time_stamp=request_time.strftime('%y%m%d_%H%M%S.%f'),
det_instance=karabo_id, det_instance=karabo_id,
request_time=request_time request_time=request_time.isoformat(),
).split() ).split()
cmd = parse_config(cmd, dconfig) cmd = parse_config(cmd, dconfig)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment