This is an automated email from the ASF dual-hosted git repository.
eladkal pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new a794e0d020 Fix Batch operator's retry_strategy (#35808)
a794e0d020 is described below
commit a794e0d020f70aca4a0d81b953402a92a430635e
Author: D. Ferruzzi <[email protected]>
AuthorDate: Wed Nov 22 20:49:54 2023 -0800
Fix Batch operator's retry_strategy (#35808)
---
airflow/providers/amazon/aws/operators/batch.py | 2 ++
tests/providers/amazon/aws/operators/test_batch.py | 8 ++++----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/airflow/providers/amazon/aws/operators/batch.py
b/airflow/providers/amazon/aws/operators/batch.py
index e917d1d81d..fe6f9dadb6 100644
--- a/airflow/providers/amazon/aws/operators/batch.py
+++ b/airflow/providers/amazon/aws/operators/batch.py
@@ -205,6 +205,8 @@ class BatchOperator(BaseOperator):
self.array_properties = array_properties
self.parameters = parameters or {}
self.retry_strategy = retry_strategy or {}
+ if not self.retry_strategy.get("attempts", None):
+ self.retry_strategy["attempts"] = 1
self.waiters = waiters
self.tags = tags or {}
self.wait_for_completion = wait_for_completion
diff --git a/tests/providers/amazon/aws/operators/test_batch.py
b/tests/providers/amazon/aws/operators/test_batch.py
index 8a0d0e788a..020f071786 100644
--- a/tests/providers/amazon/aws/operators/test_batch.py
+++ b/tests/providers/amazon/aws/operators/test_batch.py
@@ -97,7 +97,7 @@ class TestBatchOperator:
assert self.batch.hook.max_retries == self.MAX_RETRIES
assert self.batch.hook.status_retries == self.STATUS_RETRIES
assert self.batch.parameters == {}
- assert self.batch.retry_strategy == {}
+ assert self.batch.retry_strategy == {"attempts": 1}
assert self.batch.container_overrides == {}
assert self.batch.array_properties is None
assert self.batch.node_overrides is None
@@ -146,7 +146,7 @@ class TestBatchOperator:
containerOverrides={},
jobDefinition="hello-world",
parameters={},
- retryStrategy={},
+ retryStrategy={"attempts": 1},
tags={},
)
@@ -170,7 +170,7 @@ class TestBatchOperator:
containerOverrides={},
jobDefinition="hello-world",
parameters={},
- retryStrategy={},
+ retryStrategy={"attempts": 1},
tags={},
)
@@ -237,7 +237,7 @@ class TestBatchOperator:
"jobName": JOB_NAME,
"jobDefinition": "hello-world",
"parameters": {},
- "retryStrategy": {},
+ "retryStrategy": {"attempts": 1},
"tags": {},
}
if override == "overrides":