Repository navigation
Fix GKEStartPodOperator ignoring execution_timeout when deferrable - #71528
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
|
There was a problem hiding this comment.
AI Review
The fix looks right: it mirrors the deferrable KubernetesPodOperator change from #67229. GKEStartPodTrigger inherits the deadline handling from KubernetesPodTrigger, the inherited trigger_reentry already handles status="timeout", and adding trigger_kwargs to serialize() keeps the deadline across triggerer restarts. There is also a useful side effect: user-supplied trigger_kwargs and the re-defer counter (_redefer_count) now reach the GKE trigger, which was not the case before. I have left a few test-related comments inline (on test_kubernetes_engine.py:1077 and :1085). None of them is blocking. The earlier request to trim the comments has been addressed.
Smaller observations
- Minimum
cncf.kubernetesversion. The trigger-side timeout only works withapache-airflow-providers-cncf-kubernetes>=10.18.0, the first release that contains #67229. The Google provider'scncf.kubernetesextra still declares>=10.1.0. With versions 10.6–10.17, the trigger ignores_execution_deadline, so only thedefer(timeout=...)backstop fires. The task then fails through the deferral-timeout path, and the pod is not cleaned up. This is still better than running forever, and you should not change the floor in this PR (perproviders/AGENTS.md, only release managers raise>=floors). I am mentioning it so the release manager can see it. - Unspecced mocks. In the new tests,
tiis a baremock.MagicMock()(:1105,:1150,:1191). AGENTS.md says: "Usespec/autospecwhen mocking."mock.MagicMock(spec=["start_date"])would be enough here. - Gen-AI disclosure. The PR description replaces the repository's PR template, which removes the "Was generative AI tooling used to co-author this PR?" section. Please restore that section and tick it if it applies. See Gen-AI Assisted contributions.
Worth a second look from
This change mirrors the cncf.kubernetes deferrable-timeout logic. These people have the most context on it:
@jscheffl—CODEOWNERSowner forproviders/cncf/kubernetes(committer); approved #67229@paultmathew— authored #67229, the KPO change this PR ports
None of them have been notified. Asking any of them for an extra pass is the maintainer's call, and optional.
This review was drafted by an AI-assisted tool and
confirmed by an Apache Airflow maintainer. The findings
below are observations, not blockers; an Apache Airflow
maintainer — a real person — will take the next look at the
PR. If you think a finding is mis-applied, please reply on
the PR and a maintainer will weigh in.More on how Apache Airflow handles maintainer review:
contributing-docs/05_pull_requests.rst.
VladaZakharova
left a comment
There was a problem hiding this comment.
Quick question regarding scope: since GKEStartPodOperator extends KubernetesPodOperator, does this issue also affect standard KPO when deferrable=True? If so, should this logic live in the underlying cncf.kubernetes trigger/operator so both benefit from the fix, or is this specific to GKE's hook/trigger implementation?
Parametrize the three invoke_defer_method execution_timeout tests, import time_machine at module level, spec the task instance mock, and cover the poll-interval buffer, the clamp once the deadline has passed, the no-context guard, and that the operator's own trigger_kwargs are not mutated.
3be953d to
76483a0
Compare
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
Summary
Fixes #71514.
GKEStartPodOperatordid not respectexecution_timeoutwhendeferrable=Truebecause its custominvoke_defer_methoddid notpropagate the execution deadline to
GKEStartPodTrigger.What changed
execution_timeoutinto an absolute_execution_deadlineanchored to the task instance
start_date.trigger_kwargstoGKEStartPodTrigger.defer.timeoutbackstop so the trigger can emit itstimeout event before the framework timeout fires.
trigger_kwargsinGKEStartPodTrigger.serialize()so thedeadline survives trigger serialization/restarts.
behavior, existing
trigger_kwargs, and trigger serialization.Testing
TestGKEStartPodOperator: 16 passedGKEStartPodTriggerserialization test: passedOne broader trigger test run encountered an unrelated local
ModuleNotFoundError: airflow_sharedin the test infrastructure.The affected serialization test and all operator tests for this change
passed successfully.