diff --git a/webservice/webservice.py b/webservice/webservice.py index 9fa488f2308fe1d25ccb9c908b72d545822ed796..33cb29c4369dec760d0e567aaee4d9c6f6a6f1c1 100644 --- a/webservice/webservice.py +++ b/webservice/webservice.py @@ -956,7 +956,7 @@ class ActionsServer: This will trigger a correction process to be launched for that run in the given cycle and proposal. """ - request_time = datetime.now().strftime('%Y-%m-%dT%H:%M:%S') + request_time = datetime.now() try: runnr = runnr.strip('r') @@ -970,9 +970,9 @@ class ActionsServer: return msg.encode() 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', ?)", - (rid, proposal, int(runnr), request_time) + (rid, proposal, int(runnr), request_time.isoformat()) ) req_id = cur.lastrowid @@ -1105,7 +1105,7 @@ class ActionsServer: with time_db_transaction(self.job_db, 'Insert request'): cur = self.job_db.execute( "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 @@ -1170,7 +1170,7 @@ class ActionsServer: '--env-cache', f'/gpfs/exfel/data/scratch/{getuser()}/calib-repeat-envs', '--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'): @@ -1216,7 +1216,7 @@ class ActionsServer: :param runnr: is the run number in integer form, i.e. without leading "r" """ - request_time = datetime.now().strftime('%Y-%m-%dT%H:%M:%S') + request_time = datetime.now() try: pdus, karabo_das, wait_runs = ast.literal_eval(','.join(extra)) @@ -1236,7 +1236,7 @@ class ActionsServer: with time_db_transaction(self.job_db, 'Insert request'): cur = self.job_db.execute( "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 @@ -1445,9 +1445,9 @@ class ActionsServer: action=action, instrument=instrument, cycle=cycle, proposal=proposal, 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, - request_time=request_time + request_time=request_time.isoformat(), ).split() cmd = parse_config(cmd, dconfig)