Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Feature: retry strategy parameter to Amazon AWS Batch Operator #35789

Merged
merged 1 commit into from
Nov 22, 2023

Conversation

evgenyslab
Copy link
Contributor

@evgenyslab evgenyslab commented Nov 22, 2023

Added retry_strategy parameter to providers/amazon/aws/operators/batch.py that is passed to the boto3 client as retryStrategy per the syntax found here:
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/batch/client/submit_job.html

This allows definition of custom retry strategies from Airflow side instead of relying on job definitions.

Copy link

boring-cyborg bot commented Nov 22, 2023

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 Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: [email protected]
    Slack: https://s.apache.org/airflow-slack

@evgenyslab evgenyslab changed the title Added Feature: retry strategy parameter to Amazon AWS provider Batch Operator Added Feature: retry strategy parameter to Amazon AWS Batch Operator Nov 22, 2023
Copy link
Contributor

@harishkesavarao harishkesavarao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@potiuk potiuk merged commit b71c14c into apache:main Nov 22, 2023
47 checks passed
Copy link

boring-cyborg bot commented Nov 22, 2023

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

@potiuk
Copy link
Member

potiuk commented Nov 22, 2023

Nice indeed :)

@o-nikolas
Copy link
Contributor

o-nikolas commented Nov 22, 2023

@evgenyslab Looks like this change has broken the example_batch system test: https://aws-mwaa.github.io/#/open-source/system-tests/dashboard.html

Screenshot from 2023-11-22 15-28-33

  File "/opt/airflow/airflow/providers/amazon/aws/operators/batch.py", line 236, in execute
    self.submit_job(context)

  File "/opt/airflow/airflow/providers/amazon/aws/operators/batch.py", line 307, in submit_job
    raise AirflowException(e)

airflow.exceptions.AirflowException: An error occurred (ClientException) when calling the SubmitJob operation: Error executing request, Exception : RetryAttempts must be provided with retry strategy, RequestId: cbdc8976-4998-4f73-b453-70cb3d9b8ba9

@@ -201,6 +204,7 @@ def __init__(
self.scheduling_priority_override = scheduling_priority_override
self.array_properties = array_properties
self.parameters = parameters or {}
self.retry_strategy = retry_strategy or {}
Copy link
Contributor

@ferruzzi ferruzzi Nov 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to default to {"attempts": 1} and likely needs some logic to enforce that a provided value contains a valid "attempts" field.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Submitted a PR here to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers provider:amazon-aws AWS/Amazon - related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants