Skip to content
Merged

bugfix #22137

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airflow/providers/amazon/aws/hooks/base_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ def decorator_f(self, *args, **kwargs):
min_limit = retry_args.get('min', 1)
max_limit = retry_args.get('max', 1)
stop_after_delay = retry_args.get('stop_after_delay', 10)
tenacity_logger = tenacity.before_log(self.log, logging.DEBUG) if self.log else None
tenacity_logger = tenacity.before_log(self.log, logging.INFO) if self.log else None
default_kwargs = {
'wait': tenacity.wait_exponential(multiplier=multiplier, max=max_limit, min=min_limit),
'retry': tenacity.retry_if_exception(should_retry),
Expand Down
10 changes: 9 additions & 1 deletion airflow/providers/amazon/aws/operators/ecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ def should_retry(exception: Exception):
def should_retry_eni(exception: Exception):
"""Check if exception is related to ENI (Elastic Network Interfaces)."""
if isinstance(exception, EcsTaskFailToStart):
return any(eni_reason in exception.message for eni_reason in ['network interface provisioning'])
return any(
eni_reason in exception.message
for eni_reason in ['network interface provisioning', 'ResourceInitializationError']
)
return False


Expand Down Expand Up @@ -450,6 +453,11 @@ def _check_success_task(self) -> None:
for task in response['tasks']:

if task.get('stopCode', '') == 'TaskFailedToStart':
# Reset task arn here otherwise the retry run will not start
# a new task but keep polling the old dead one
# I'm not resetting it for other exceptions here because
# EcsTaskFailToStart is the only exception that's being retried at the moment
self.arn = None
raise EcsTaskFailToStart(f"The task failed to start due to: {task.get('stoppedReason', '')}")

# This is a `stoppedReason` that indicates a task has not
Expand Down