Repository navigation
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
|
This looks really good - can you please add test cases covering the timeout handling in supervisor ? |
|
Added a comprehensive test suite for timeout handling as requested. All tests are passing. Test Coverage:
|
|
Hi, I wanted to follow up on this contribution. Is there anything I can do to help move this forward or any additional information needed? |
Turning that PR green might be a good start. |
|
Hi, I wanted to follow up on this contribution. |
|
@qwe-kev can you help fixing the CI and resolving merge conflicts on this one? We could take a look once that's done. |
|
@qwe-kev Converting to draft — this PR doesn't yet meet our Pull Request quality criteria.
See the linked criteria for how to fix each item, then mark the PR "Ready for review". This is not a rejection — just an invitation to bring the PR up to standard. No rush. Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this two-stage triage process so that our maintainers' limited time is spent where it matters most: the conversation with you. |
closes: apache#53337 related: apache#57174 This PR implements proper execution timeout handling for Airflow 3.0 by moving timeout enforcement from the task process to the supervisor process. Previously, execution_timeout was handled inside the task process using a timeout decorator. This approach failed when: - Task process encountered SIGSEGV or other signals (apache#57174) - Native code ran in tight loops without handling Python signals - Process was killed before timeout could be enforced Changes: - Added TaskExecutionTimeout message for worker-to-supervisor communication - Supervisor monitors execution time and enforces timeout with SIGTERM/SIGKILL - Removed in-process timeout decorator from task execution - Timeout measurement starts after DAG parsing (excludes startup overhead) Implementation: 1. Worker sends timeout_seconds to supervisor after DAG parsing 2. Supervisor tracks elapsed time using monotonic clock 3. On timeout: sends SIGTERM, then SIGKILL after 5-second grace period This ensures reliable timeout enforcement at the supervisor level, preventing runaway tasks even when the task process encounters errors.
- Add 9 unit tests for timeout handling logic - Test SIGTERM/SIGKILL escalation behavior - Test grace period enforcement - Test monotonic clock usage - Test message serialization - Add 4 integration tests with real subprocesses - Test actual timeout enforcement - Test SIGKILL escalation when task ignores SIGTERM - Test tasks completing before/without timeout - Add client_with_ti_start fixture for mocking API client - Tests account for MIN_HEARTBEAT_INTERVAL in timing assertions All 13 tests passing. No existing tests broken.
defined on BaseOperator. Addresses review feedback
- Changed falsy checks to 'is None' checks in supervisor.py to handle edge case where timeout values could be 0.0 - Added validation in task_runner.py to only send positive timeouts - Prevents 0.0 (falsy) from being incorrectly treated as None Addresses reviewer feedback
- Add test coverage for TaskExecutionTimeout message in test_supervisor.py - Remove deprecated test_run_task_timeout and test_execution_timeout from test_task_runner.py (timeout now handled by supervisor, covered by TestExecutionTimeoutIntegration tests) - Remove unused imports (AirflowTaskTimeout, _execute_task, time) - Set expected_body=None for TaskExecutionTimeout as it's a one-way message All tests now pass (689 passed).
6081148 to
bee59e7
Compare
|
@qwe-kev — Removing the The label's contract is that the PR is ready for maintainer review — a regression like this means the PR temporarily isn't. Rebase your branch onto the latest
No rush. Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this two-stage triage process so that our maintainers' limited time is spent where it matters most: the conversation with you. |
|
@qwe-kev This draft PR has been inactive for 60 days since the last triage comment and no response from the author. Closing to keep the queue clean. You are welcome to reopen this PR when you resume work, or to open a new one addressing the issues previously raised. There is no rush — take your time. Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this two-stage triage process so that our maintainers' limited time is spent where it matters most: the conversation with you. |
closes: #53337
related: #57174
This PR implements proper execution timeout handling for Airflow 3.0 by moving timeout enforcement from the task process to the supervisor process.
Previously, execution_timeout was handled inside the task process using a timeout decorator. This approach failed when:
Changes
Implementation
This ensures reliable timeout enforcement at the supervisor level, preventing runaway tasks even when the task process encounters errors.