Skip to content

Commit

Permalink
move logging to _process_message_<event> for submit/failure
Browse files Browse the repository at this point in the history
  • Loading branch information
wxtim committed Oct 24, 2024
1 parent 502b63b commit 7b0a7b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion changes.d/6169.fix
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Ensure that job failure is logged, even when the presence of retries causes the task not to change state.
Ensure that job submit/failure is logged, even when retries are planned.
12 changes: 10 additions & 2 deletions cylc/flow/task_events_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -928,11 +928,16 @@ def _process_message_check(
return False

severity_lvl: int = LOG_LEVELS.get(severity, INFO)
# Don't log submit/failure messages here:
if flag != self.FLAG_POLLED and message in {
self.EVENT_SUBMIT_FAILED, f'{FAIL_MESSAGE_PREFIX}ERR'
}:
return True
# Demote log level to DEBUG if this is a message that duplicates what
# gets logged by itask state change anyway (and not manual poll)
if severity_lvl > DEBUG and flag != self.FLAG_POLLED and message in {
self.EVENT_SUBMITTED, self.EVENT_STARTED, self.EVENT_SUCCEEDED,
self.EVENT_SUBMIT_FAILED, f'{FAIL_MESSAGE_PREFIX}ERR'
self.EVENT_FAILED
}:
severity_lvl = DEBUG
LOG.log(severity_lvl, f"[{itask}] {flag}{message}{timestamp}")
Expand Down Expand Up @@ -1334,6 +1339,9 @@ def _process_message_failed(
self.data_store_mgr.delta_task_output(
itask, TASK_OUTPUT_FAILED)
self.data_store_mgr.delta_task_state(itask)
LOG.error(
f'[{itask}] {full_message or self.EVENT_FAILED} - '
)
else:
# There is an execution retry lined up.
timer = itask.try_timers[TimerFlags.EXECUTION_RETRY]
Expand Down Expand Up @@ -1414,7 +1422,6 @@ def _process_message_submit_failed(
Return True if no retries (hence go to the submit-failed state).
"""
no_retries = False
LOG.critical(f"[{itask}] {self.EVENT_SUBMIT_FAILED}")
if event_time is None:
event_time = get_current_time_string()
self.workflow_db_mgr.put_update_task_jobs(itask, {
Expand All @@ -1440,6 +1447,7 @@ def _process_message_submit_failed(
self.data_store_mgr.delta_task_output(
itask, TASK_OUTPUT_SUBMIT_FAILED)
self.data_store_mgr.delta_task_state(itask)
LOG.error(f"[{itask}] {self.EVENT_SUBMIT_FAILED}")
else:
# There is a submission retry lined up.
timer = itask.try_timers[TimerFlags.SUBMISSION_RETRY]
Expand Down

0 comments on commit 7b0a7b1

Please sign in to comment.