Skip to content

Forward hook config to BatchJobTrigger from the BatchSensor #72278

Open

Description

@jroachgolf84

Description

This is an issue that is reserved for the Airflow Summit "Contributors" Workshop. This is denoted with the label contributors-workshop. Out of respect for the organizers and participants of this workshop, please do not implement a PR that addresses this issue.

If this issue is still open following Airflow Summit, the label will be removed and the issue can be picked up.

Sub-issue of #72144, covering one of the three defer sites set aside for the Contributor's Workshop in this comment.

Call site providers/amazon/src/airflow/providers/amazon/aws/sensors/batch.py, in BatchSensor.execute
Trigger BatchJobTrigger in providers/amazon/src/airflow/providers/amazon/aws/triggers/batch.py
Shape Call site only, the trigger already accepts the parameters

BatchSensor is an AwsBaseSensor, so it always carries region_name, verify and botocore_config. When it defers it passes only region_name to BatchJobTrigger, so the triggerer rebuilds its hook without the SSL verification setting and without the botocore configuration the synchronous half of the task was using.

What needs to change?

This one is small because nothing on the trigger side is in the way. BatchJobTrigger.__init__ already takes **kwargs and forwards them to AwsBaseWaiterTrigger, and its hook() already reads all three values off self:

def hook(self) -> AwsGenericHook:
    return BatchClientHook(
        aws_conn_id=self.aws_conn_id,
        region_name=self.region_name,
        verify=self.verify,
        config=self.botocore_config,
    )

They are simply never populated, because the sensor stops after region_name. The fix is to add the two missing arguments at the defer site so the trigger receives what it is already prepared to use.

There is a working reference for this in the same provider. BatchOperator defers to the same trigger from providers/amazon/src/airflow/providers/amazon/aws/operators/batch.py and already passes all three, so the sensor should end up matching that call.

How to verify it

The parent issue's reproduction applies: construct the sensor with a non-default region_name, verify and botocore_config, trigger the defer, and assert those values survive into the serialized payload.

with pytest.raises(TaskDeferred) as deferred:
    sensor.execute(None)

assert deferred.value.trigger.serialize()[1]

AwsBaseWaiterTrigger.serialize prunes empty values, so use values that are actually distinguishable from the defaults, and assert on the serialized dict rather than on attributes of the trigger object.

Definition of Done

  1. Pass verify and botocore_config through to BatchJobTrigger at the defer site in sensors/batch.py.
  2. Add or extend a unit test asserting all three survive into the serialized trigger payload.
  3. Once Build deferred AWS hooks from the operator's own settings #72171 has landed, remove the ("sensors/batch.py", "BatchJobTrigger") entry from the PENDING_MIGRATION allowlist that PR introduces. That allowlist does not exist on main yet, so this step only applies after it merges. The invariant test asserts each entry is still needed, so a stale line fails the suite.
  4. These should pass:
breeze testing providers-tests providers/amazon/tests/unit/amazon/aws/sensors/test_batch.py

breeze testing providers-tests providers/amazon/tests/unit/amazon/aws/triggers/test_batch.py

Note on sequencing. The code change here is independent of #72171 and can be made and reviewed straight away. Only the allowlist deletion in step 3 has to wait for that PR.


Drafted-by: Claude Code (Opus 5); reviewed and edited by @jroachgolf84 before posting

Activity

  1. added
    kind:bug
    provider:amazon
    contributors-workshop
    on Aug 30, 2026
  2. self-assigned this
    on Aug 30, 2026
  3. jroachgolf84 commented on Aug 30, 2026

    @jroachgolf84
    CollaboratorAuthor

    This is an issue that is reserved for the Airflow Summit "Contributors" Workshop. This is denoted with the label contributors-workshop. Out of respect for the organizers and participants of this workshop, please do not implement a PR that addresses this issue.

    If this issue is still open following Airflow Summit, the label will be removed and the issue can be picked up.

  4. nickgarza-google-tse commented on Sep 2, 2026

    @nickgarza-google-tse

    comment to request ownership during workshop

  5. jroachgolf84 commented on Sep 2, 2026

    @jroachgolf84
    CollaboratorAuthor

    Assigned!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:providerscontributors-workshopkind:bugprovider:amazon

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions