manipatnam commented on code in PR #74458:
URL: https://github.com/apache/airflow/pull/74458#discussion_r4219397698
##########
task-sdk/src/airflow/sdk/execution_time/supervisor.py:
##########
@@ -1794,6 +1806,24 @@ def update_task_state_if_needed(self):
)
return
+ # The task process was killed by something outside this supervisor (the
+ # kernel's OOM killer, an external SIGKILL, SIGSEGV) and never
reported a
+ # state of its own. Leave the task instance in `running` so the
scheduler
+ # finalises it through `handle_failure`, which fires
+ # `on_task_instance_failed` and builds a `TaskCallbackRequest`. The
+ # supervisor can do neither: it never parses the dag, and has no
database
+ # access. Reporting the state here instead makes the task terminal
before
+ # the scheduler ever looks at it, so no callback is raised and no
+ # OpenLineage FAIL event is emitted. See #60858.
+ if self._externally_killed_without_reporting():
+ log.warning(
+ "Task process was killed by a signal without reporting a
terminal state; "
+ "leaving it for the scheduler to finalise",
+ exit_code=self._exit_code,
+ ti_id=self.id,
+ )
Review Comment:
Yes on KubernetesExecutor, but not on Celery or Local, those finalise on the
next scheduler loop, since they report a terminal state the scheduler can spot
as a mismatch. That's the trade-off I took to get task failure callbacks and OL
events firing for SIGKILLed tasks without making any changes to execution API.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]