fix: GKEKubernetesAsyncHook missing _event_polling_fallback attribute #60601
+5
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
After upgrading to 3.1.6, we started seeing the following error in our GKEStartPodOperator execution, running in
deferredmode:_event_polling_fallbackattribute #60600Problem
After some research it looks like it's a result of the addition of the
_event_polling_fallbackin the AsyncKubernetesHook. This is never initialized in theGKEKubernetesAsyncHook, because theAsyncKubernetesHookinit method is never called, due to disruption of the MRO chain.With the current initialization of
GKEKubernetesAsyncHook, the MRO is:GKEKubernetesAsyncHookGoogleBaseAsyncHook-> Doesn't callsuper().__init__(), so it stops hereAsyncKubernetesHookKubernetesHookBaseHookAs stated, the initialization stops after 2 due to a missing
super().__init__(). Hence, the_event_polling_fallbackmethod is never added.Solution
I figured it would be less invasive to explicitly call both init methods. We could also consider adding the
super().__init__()call toGoogleBaseAsyncHook. This area is relatively new to me, so I'm very open to discuss this!Though the latter feels more invasive, it also feels like a more proper solution.
EDIT: latter solution doesn't work as it will pass the
gcp_conn_idandimpersonation_chainto the BaseHook.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Sonnet 4.5 following the guidelines
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.