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

Merge branch 'fix/webservice-mymdc-e' into 'master'

Send 'E' and 'IP' statuses to myMdC for correction jobs

See merge request !800
parents af6e09b5 c4850c8c
No related branches found
No related tags found
1 merge request!800Send 'E' and 'IP' statuses to myMdC for correction jobs
......@@ -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)
......
......@@ -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':
......
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