Skip to content

Commit

Permalink
fix: continue_on_success_ratio without slice raise error
Browse files Browse the repository at this point in the history
  • Loading branch information
saltball committed Jan 23, 2025
1 parent 0ab9b32 commit bbbc978
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/dflow/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,8 @@ def merge_output_artifact(art, parent, layer=0):
self.template.set_slices(self.template.slices)
self.with_param = argo_range(if_expression(
"%s %% %s > 0" % (nslices, group_size),
"%s/%s + 1" % (nslices, group_size),
"(%s - %s %% %s) / %s + 1" % (nslices,
nslices, group_size, group_size),
"%s/%s" % (nslices, group_size)))
elif self.with_param is not None:
self.template.inputs.parameters["dflow_with_param"] = \
Expand All @@ -745,7 +746,8 @@ def merge_output_artifact(art, parent, layer=0):
self.template.set_slices(self.template.slices)
self.with_param = argo_range(if_expression(
"%s %% %s > 0" % (nslices, group_size),
"%s/%s + 1" % (nslices, group_size),
"(%s - %s %% %s) / %s + 1" % (nslices,
nslices, group_size, group_size),
"%s/%s" % (nslices, group_size)))
if self.with_sequence is not None:
self.template.inputs.parameters["dflow_sequence_start"] = \
Expand Down Expand Up @@ -799,7 +801,8 @@ def merge_output_artifact(art, parent, layer=0):
self.with_sequence = argo_sequence(
count=if_expression(
"%s %% %s > 0" % (nslices, group_size),
"%s/%s + 1" % (nslices, group_size),
"(%s - %s %% %s) / %s + 1" % (nslices,
nslices, group_size, group_size),
"%s/%s" % (nslices, group_size)), format=format)

self.inputs.parameters["dflow_nslices"] = InputParameter(
Expand Down Expand Up @@ -932,6 +935,7 @@ def add_success_tag(templ):
}
)
elif self.continue_on_success_ratio is not None:
total = 1
if "dflow_nslices" in self.inputs.parameters:
total = self.inputs.parameters["dflow_nslices"].value
elif self.with_param is not None:
Expand Down

0 comments on commit bbbc978

Please sign in to comment.