Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions task-sdk/src/airflow/sdk/execution_time/supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,15 +1125,15 @@ def _send_heartbeat_if_needed(self):
except Exception as e:
self._handle_heartbeat_failures(e)

def _handle_heartbeat_failures(self, exc: Exception | None):
def _handle_heartbeat_failures(self, exc: Exception):
"""Increment the failed heartbeats counter and kill the process if too many failures."""
self.failed_heartbeats += 1
log.warning(
"Failed to send heartbeat. Will be retried",
failed_heartbeats=self.failed_heartbeats,
ti_id=self.id,
max_retries=MAX_FAILED_HEARTBEATS,
exception=exc,
exc_info=exc,
)
# If we've failed to heartbeat too many times, kill the process
if self.failed_heartbeats >= MAX_FAILED_HEARTBEATS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ def test_heartbeat_failures_handling(self, monkeypatch, mocker, captured_logs, t
"level": "warning",
"logger": "supervisor",
"timestamp": mocker.ANY,
"exception": mocker.ANY,
"exc_info": mocker.ANY,
"loc": mocker.ANY,
}

Expand Down