Skip to content
Merged
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
18 changes: 16 additions & 2 deletions metaflow/plugins/argo/argo_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,19 @@ def _visit(
"{{=sprig.int(sprig.sub(sprig.int(inputs.parameters['num-parallel']),1))}}"
),
]
if any(d.name == "retry" for d in node.decorators):
# Resolve retry strategy to determine if we should add retry-related parameters.
# {{retries}} is only available if retryStrategy is specified in the template.
max_user_code_retries = 0
max_error_retries = 0
for decorator in node.decorators:
user_code_retries, error_retries = decorator.step_task_retry_count()
max_user_code_retries = max(
max_user_code_retries, user_code_retries
)
max_error_retries = max(max_error_retries, error_retries)

total_retries = max_user_code_retries + max_error_retries
if total_retries > 0:
parameters.extend(
[
Parameter("retryCount").value("{{retries}}"),
Expand Down Expand Up @@ -2381,7 +2393,9 @@ def _container_templates(self):
Parameter("workerCount"),
]
)
if any(d.name == "retry" for d in node.decorators):
# {{retries}} is only available if retryStrategy is specified in the template.
# Only add retryCount input parameter if total_retries > 0.
if total_retries > 0:
inputs.append(Parameter("retryCount"))

if node.is_inside_foreach and self.graph[node.out_funcs[0]].type == "join":
Expand Down
Loading