diff --git a/webservice/job_monitor.py b/webservice/job_monitor.py index ce5a6a0582ef36c5617d7c9306dce7af8c200191..d0662a20351a9cca97797f919142d16dfc2b7ed2 100644 --- a/webservice/job_monitor.py +++ b/webservice/job_monitor.py @@ -279,18 +279,17 @@ class JobsMonitor: log.debug("Update MDC for %s, %s: %s", r['action'], r['mymdc_id'], msg) if r['action'] == 'CORRECT': - status = 'A' if success else 'NA' # Not-/Available + status = 'A' if success else 'E' # Available/Error self.mymdc_update_run(r['mymdc_id'], msg, status) else: # r['action'] == 'DARK' status = 'F' if success else 'E' # Finished/Error self.mymdc_update_dark(r['mymdc_id'], msg, status) - def mymdc_update_run(self, run_id, msg, status='R'): + def mymdc_update_run(self, run_id, msg, status='IP'): """Update correction status in MyMdC""" - data = {'cal_pipeline_reply': msg} - if status != 'R': + data = {'cal_pipeline_reply': msg, 'flg_cal_data_status': status} + if status != 'IP': data['cal_last_end_at'] = datetime.now(tz=timezone.utc).isoformat() - data['flg_cal_data_status'] = status response = self.mdc.update_run_api(run_id, data) if response.status_code != 200: log.error("Failed to update MDC run id %s", run_id) diff --git a/webservice/webservice.py b/webservice/webservice.py index 600168b542fe5e9874131dec281328b5ee7a530b..dda291c2e48d9ab5ef1fca10f3422daf17a75158 100644 --- a/webservice/webservice.py +++ b/webservice/webservice.py @@ -742,19 +742,19 @@ async def update_mdc_status(mdc: MetadataClient, action: str, https://git.xfel.eu/gitlab/detectors/pycalibration/wikis/MyMDC-Communication """ if message.split(':')[0] in ('FAILED', 'WARN'): # Errors - flag = 'NA' if action == 'correct' else 'E' + flag = 'E' elif message.split(':')[0] == 'SUCCESS': # Success - flag = 'R' if action == 'correct' else 'IP' + flag = 'IP' if 'Uploaded' in message or 'Finished' in message: flag = 'A' if action == 'correct' else 'F' else: # MDC Timeout - flag = 'NA' if action == 'correct' else 'T' + flag = 'E' if action == 'correct' else 'T' if action == 'correct': func = mdc.update_run_api data = {'cal_pipeline_reply': message} - # Don't send the 'R' status, as this may trigger another correction - if flag != 'R': + # Don't send In Progress; job_monitor will send this when jobs start. + if flag != 'IP': data['flg_cal_data_status'] = flag elif action == 'dark_request':