Skip to content
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

Retries using with-items runs a retry even on objects that succeeded as well #201

Open
soumyabk opened this issue Apr 24, 2020 · 5 comments

Comments

@soumyabk
Copy link

soumyabk commented Apr 24, 2020

We use the with-items to loop over and run an action.
If it fails for even one of them, it retries over all the items in the array again, instead of just retrying the failed ones.

For instance, if param1 was set to 1,2,3,4 in the below sample workflow:

version:                1.0
description:            Test retry workflow
input:
  - param1
  - slack_channel
tasks:
  split_list:
    action: core.noop
    next:
    - when: <% succeeded() %>
      do: print_val
      publish:
        - list_vals: <% ctx(param1).split(',') %>
  print_val:
    with: <% ctx(list_vals) %>
    action: core.local
    input :
      cmd : >
        val=<% item() %>;
        if [ $val -eq 2 ];then exit -1;fi
    retry:
      when: <% failed() %>
      count: 5
      delay: 2
    next:
      - when: <% succeeded() %>
        publish:
          - status: "SUCCESS"
      - when: <% failed() %>
        do:
          - send_failed_alert
        publish:
          - status: "FAILED"
  send_failed_alert:
    action: slack.chat.postMessage
    input:
      channel: "#<% ctx(slack_channel) %>"
      text: "ERROR: failed on param <% ctx(param1) %> failed"`

And here is the output of the run.

image

@m4dcoder
Copy link
Collaborator

In current implementation, the retry is scoped to the task so it retry the task and not the items in the case of with items. We can add an option in the retry spec to retry only failed items.

@m4dcoder
Copy link
Collaborator

The following is one possible solution for the retry spec to support per-item retry.

    retry:
      items:
        when: <% some condition on the action execution for the item %>
        count: 3
        delay: 1

@kyildiz
Copy link

kyildiz commented Jun 10, 2020

The following is one possible solution for the retry spec to support per-item retry.

    retry:
      items:
        when: <% some condition on the action execution for the item %>
        count: 3
        delay: 1

Your proposed solution per-item retry does not work.

@m4dcoder
Copy link
Collaborator

@kyildiz It was a proposal and not supported yet.

@guzzijones
Copy link
Contributor

you can wrap your action in a workflow and put the retry logic in the subworkflow for now as a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants