Pass verify and botocore_config to BatchJobTrigger in BatchSensor (#72278) - #72449
Open
nickgarza-google-tse wants to merge 1 commit into
Open
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
|
| aws_conn_id=self.aws_conn_id, | ||
| region_name=self.region_name, | ||
| verify=self.verify, | ||
| botocore_config=self.botocore_config, |
Contributor
There was a problem hiding this comment.
I would advise you to run the prek hook locally to catch formatting errors like this.
| _, kwargs = trigger.serialize() | ||
| assert kwargs.get("region_name") == AWS_REGION | ||
| assert kwargs.get("verify") == "/custom/ca_bundle.pem" | ||
| assert kwargs.get("botocore_config") == {"read_timeout": 45} |
Contributor
There was a problem hiding this comment.
I dont think it is necessary to cover region_name as my understanding is that the intention of this PR is to forward the 2 additional arguments i.e. verify and botocore_config.
Contributor
|
Done |
2 tasks
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 free
to 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.
Closes: #72278
Related-to: #72144
Description
In
BatchSensor, when running in deferrable mode,BatchJobTriggerwas initialized passing onlyregion_name, omittingverifyandbotocore_config.Because
BatchSensorinherits fromAwsBaseSensor, it already captures these configurations during initialization. Without forwarding them toBatchJobTrigger, the triggerer process reconstructs the AWS Batch client hook using default connection settings, causing custom SSL certificates (verify) and custombotocore_config(such as timeouts, retries, and user agents) to be lost upon deferral.This change:
verify=self.verifyandbotocore_config=self.botocore_configtoBatchJobTriggerinBatchSensor.execute()upon deferral (aligning withBatchOperator).region_name,verify, andbotocore_configsurvive and persist into the serialized trigger payload.Use Case / Motivation
Preserves custom AWS configuration (e.g., custom CA bundles/SSL settings and botocore connection parameters) across task deferral boundaries when polling AWS Batch jobs asynchronously.
Related Issues
BatchJobTriggerfrom theBatchSensor#72278Code Changes Summary
providers/amazon/src/airflow/providers/amazon/aws/sensors/batch.pyverify=self.verifyandbotocore_config=self.botocore_configtoBatchJobTrigger.providers/amazon/tests/unit/amazon/aws/sensors/test_batch.pytest_execute_in_deferrable_mode_passes_aws_configsverifying parameters in serialized trigger dictionary.Checklists
main?breeze testing providers-tests providers/amazon/tests/unit/amazon/aws/sensors/test_batch.pybreeze testing providers-tests providers/amazon/tests/unit/amazon/aws/triggers/test_batch.pybreeze static-checks --last-commit