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

Send just one update to myMdC when correction finishes

parent 1093aa1a
No related branches found
No related tags found
1 merge request!599Don't send updates to myMdC when all jobs are pending
......@@ -427,10 +427,6 @@ def update_job_db(config):
except KafkaError:
logging.warning("Error sending Kafka notification",
exc_info=True)
mdc.update_run_api(
rid, # The result from MyMDC does not matter here.
{'cal_last_end_at': datetime.now(tz=timezone.utc).isoformat()}
)
if all(s.startswith('PD-') for s in statii):
# Avoid swamping myMdC with updates for jobs still pending.
......@@ -443,14 +439,19 @@ def update_job_db(config):
msg = "\n".join(statii)
msg_debug = f"Update MDC {rid}, {msg}"
logging.debug(msg_debug.replace('\n', ', '))
if action == 'CORRECT':
response = mdc.update_run_api(rid,
{'flg_cal_data_status': flg,
'cal_pipeline_reply': msg})
data = {'flg_cal_data_status': flg,
'cal_pipeline_reply': msg}
if flg != 'R':
data['cal_last_end_at'] = datetime.now(tz=timezone.utc).isoformat()
response = mdc.update_run_api(rid, data)
else: # action == 'DARK' but it's dark_request
data = {'dark_run': {'flg_status': dark_flags[flg],
'calcat_feedback': msg}}
response = mdc.update_dark_run_api(rid, data)
if response.status_code != 200:
logging.error("Failed to update MDC for action %s, rid %s",
action, rid)
......
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