diff --git a/webservice/webservice.py b/webservice/webservice.py index 4dc675beb41be7038799546f9304089a144633f7..a861aadbb49fb7951bd724fff332a14a5c9d3e4b 100644 --- a/webservice/webservice.py +++ b/webservice/webservice.py @@ -935,6 +935,15 @@ class ActionsServer: return queued_msg.encode() async def handle_repeat(self, rid, instrument, cycle, proposal, runnr): + request_time = datetime.now().strftime('%Y-%m-%dT%H:%M:%S') + + with self.job_db: + cur = self.job_db.execute( + "INSERT INTO requests VALUES (NULL, ?, ?, ?, 'CORRECT', ?)", + (rid, proposal, int(runnr), request_time) + ) + req_id = cur.lastrowid + reports_dir = Path(self.config['correct']['reports-folder'].format( instrument=instrument, cycle=cycle, proposal=proposal, runs=runnr )) @@ -966,9 +975,17 @@ class ActionsServer: logging.info("Repeating correction for %s from %s", karabo_id, mddir) cmd = ['python', '-m', 'xfel_calibrate.repeat', mddir] + + with self.job_db: + cur = self.job_db.execute( + "INSERT INTO executions VALUES (NULL, ?, ?, NULL, ?, NULL)", + (req_id, shlex.join(cmd), karabo_id) + ) + exec_id = cur.lastrowid + await run_action( self.job_db, cmd, self.mode, - proposal, runnr, rid + proposal, runnr, exec_id ) async def handle_dark_request(