qwe-kev commented on code in PR #59657:
URL: https://github.com/apache/airflow/pull/59657#discussion_r2639632601
##########
task-sdk/src/airflow/sdk/execution_time/supervisor.py:
##########
@@ -955,6 +956,16 @@ class ActivitySubprocess(WatchedSubprocess):
_task_end_time_monotonic: float | None = attrs.field(default=None,
init=False)
_rendered_map_index: str | None = attrs.field(default=None, init=False)
+ # Execution timeout tracking
+ _execution_timeout_seconds: float | None = attrs.field(default=None,
init=False)
+ """Task execution timeout in seconds, received from the task process."""
+
+ _task_execution_start_time: float | None = attrs.field(default=None,
init=False)
+ """Monotonic time when task execution actually started (after parsing
DAG)."""
+
+ _timeout_sigterm_sent_at: float | None = attrs.field(default=None,
init=False)
+ """Monotonic time when SIGTERM was sent due to timeout."""
Review Comment:
You're right! I've updated the code to use explicit is None checks
throughout to handle the edge case where these float values could technically
be 0.0 (which is falsy in Python). Made the following changes:
1) supervisor.py - Changed falsy checks to explicit None checks:
- Line 1135: if not self._execution_timeout_seconds → if
self._execution_timeout_seconds is None
- Line 1138: if not self._task_execution_start_time → if
self._task_execution_start_time is None
2) task_runner.py - Added validation to only send positive timeouts:
- Line 761: Added if timeout_seconds > 0: check before sending timeout
to supervisor
--
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]