Uh oh!
There was an error while loading. Please reload this page.
Build deferred AWS hooks from the operator's own settings - #72171
Open
SEPURI-SAI-KRISHNA wants to merge 3 commits into
Open
Build deferred AWS hooks from the operator's own settings#72171SEPURI-SAI-KRISHNA wants to merge 3 commits into
SEPURI-SAI-KRISHNA wants to merge 3 commits into
Conversation
2 tasks
An AwsBaseOperator/AwsBaseSensor subclass resolves region_name, verify and botocore_config in __init__, but did not hand them to the trigger it defers to. The trigger builds its own hook, so the deferred half of the task reached AWS with the default region, SSL verification silently re-enabled, and any custom botocore timeouts or retries discarded. The triggers already accept all three, so only the call sites were missing.
Every Neptune Analytics operator accepts `verify` through the shared AWS base class, but none of the seven class docstrings mentioned it, so the rendered provider docs gave users no way to discover it. Two of those docstrings even carried a stray blank line where the entry belonged. The deferral tests now compare the trigger's serialized payload rather than its attributes. Serialization is what actually crosses into the triggerer process, and it passes values through `prune_dict`, so an attribute-level assertion can pass while the setting is silently dropped on the way there. This matches the assertion style already used for the Neptune cluster operators.
An AWS operator always carries region_name, verify and botocore_config, but on deferral the trigger builds its own hook. Most triggers accepted none of those parameters and constructed the hook from aws_conn_id alone, so the triggerer silently fell back to boto3 defaults: a different region, default SSL verification, and none of the configured timeouts or retry policy. The task changed behaviour purely by virtue of deferring, and did so without any error. Fixing this service by service would have meant editing every trigger signature as well as every call site, so the hook is now built in one place from the parameters the base trigger already serializes. Subclasses name the hook they need instead of constructing it, which is the same arrangement the operators use. The accompanying invariant test walks every defer site in the provider and fails if one does not hand its hook configuration to the trigger, so an operator added later cannot reintroduce the gap unnoticed. Three services are deliberately left for the Contributors Workshop and are named in the test's allowlist rather than skipped silently.
SEPURI-SAI-KRISHNAforce-pushed
the
fix-aws-deferred-hook-config-base
branch
from
August 31, 2026 07:37
6509b9e to
d7f8a6eCompare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Addresses the bulk of the deferred hook-configuration gap tracked in #72144.
AwsBaseWaiterTriggernow builds the hook itself, from the parameters it already serializes, driven by anaws_hook_classattribute, the same arrangementAwsBaseHookMixingives the operators. Subclasses name the hook they need instead of constructing it, soregion_name,verifyandbotocore_configreach the triggerer by default rather than only where asubclass remembered to thread them through.
That removes 40 bespoke
hook()implementations, and takes the provider from 49 of 113 defer sites forwarding the full hook configuration to 110 of 113.What is deliberately left out
Three services are reserved for the Contributors Workshop, at the request of the workshop organiser on #72144:
sensors/batch.py,sensors/opensearch_serverless.pyandoperators/sagemaker_unified_studio_notebook.py. They are listed inPENDING_MIGRATIONin the invariant test, which asserts each entry is still needed, a stale line fails the suite, so the allowlist cannot outlive the work it tracks.SageMakerNotebookOperatordefers toSageMakerNotebookJobTrigger, which is a plainBaseTriggerwhose hook is addressed by execution name and takes no connection parameters at all.EksPodOperatordefers toEksPodTrigger, aKubernetesPodTriggerthat reaches the pod through a kubeconfig rather than a boto3 client. Neither is an instance of this bug; both are named explicitly in the test rather than passed over silently.Invariant test
test_deferred_hook_configuration.pywalks everyself.defer(trigger=...)call in the provider and fails if one does not pass the hook configuration, plus asserts everyAwsBaseWaiterTriggersubclass can actually build a hook. It resolves atrigger=expression to every construction it can evaluate to, so a trigger chosen in a conditional expression is checked on both branches, that is how the twoEmrContainersites were caught. A defer site whose trigger is a bare reference is asserted against an explicit allowlist rather than skipped. An operator added later that forgets the parameters fails in CI rather than in production.Notes for review
aws_hook_classbinds the hook at class definition, so the@patch("...triggers.<module>.<Hook>")idiom no longer intercepts it for migrated triggers. No existing test needed changing as a result.EmrContainerTrigger's hook takes an extravirtual_cluster_id, so it overrides_hook_parametersrather than using the default, the escape hatch the base class keeps for exactly this.EksDeleteClusterTriggerbypasses the base__init__and rolls its ownserialize(), so it sets and serializes the two new parameters explicitly.airflow_shared,common.messaging, openlineage).Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5) following the guidelines