-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Break sequential loop if an iteration fails #3644
Comments
When you use Perhaps using this recursive for loop example might work better for this use case? |
I believe we used to fail fast when parallelism was reduced. This might be a regression. |
@simster7 I could indeed use recursive for loop, but I have hundreds of iteration which I feel will end |
I'll investigate @jessesuen's comment that this is in fact a regression and it should actually be possible to have the behavior you desired using |
Thank you for digging into that issue |
I took a look at the code and I don't get any indication that this behavior should actually be possible. I will discuss with @jessesuen and report back |
I discussed this with Jesse and tried this in 2.5 (https://github.com/argoproj/argo/blob/release-2.5/workflow/controller/steps.go) and we determined that this was never possible, so it is in fact an enhancement. We've determined that this is something we would consider, we would just need to come up with a design that would allow the user to specify that they would like this behavior when using |
I would really appreciate this feature. |
This is now supported by setting - name: seq-loop
failFast: true
inputs:
parameters:
- name: items
parallelism: 1
steps:
- - name: iteration
template: iteration
withParam: '{{inputs.parameters.items}}' This will be out on v3.1 |
Tagging upvoters: @tanenbaum @ppapasani1 @jbehling @oliverwm1 @shbalaku @trim777 @bybybybyb @dinever @rajasudhan @raph-af @camilocot |
Thank you for the update, that seems nice! Can you confirm that it will work with a Also, is there a way to test the v3.1 at its current stage? |
Yes. If we have Try this. We have 5 iterations and apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: seq-loop-
spec:
arguments:
parameters:
- name: items
value: |
["a", "b", "c", "d", "e"]
entrypoint: seq-loop
templates:
- name: seq-loop
failFast: true
parallelism: 3
inputs:
parameters:
- name: items
steps:
- - name: iteration
template: iteration
withParam: "{{inputs.parameters.items}}"
- name: iteration
steps:
- - name: step1
template: succeed-step
- - name: step2
template: failed-step
- name: succeed-step
container:
image: alpine
command: ['/bin/sh', '-c']
args: ["exit 0"]
- name: failed-step
container:
image: alpine
command: ['/bin/sh', '-c']
args: ["exit 1"] |
Summary
Break sequential loop if an iteration fails
Motivation
I have a sequential loop using
parallelism: 1
and I need to stop the loop execution when an iteration fails,in order to not process next iteration if previous one has failed.
Given this template:
Currently, executing this workflow gives:
I would like to be able to break the loop if an iteration fails:
Message from the maintainers:
If you wish to see this enhancement implemented please add a 👍 reaction to this issue! We often sort issues this way to know what to prioritize.
The text was updated successfully, but these errors were encountered: