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

Allow optional output parameters by specifying a default value #954

Closed
gaoning777 opened this issue Aug 16, 2018 · 9 comments
Closed

Allow optional output parameters by specifying a default value #954

gaoning777 opened this issue Aug 16, 2018 · 9 comments

Comments

@gaoning777
Copy link

BUG REPORT
When the output resource is not generated in the container, the whole workflow failed.
For example:

outputs:
      parameters:
      - name: hello
        valueFrom:
          path: /hello.json

When hello.json is not output in the container, the whole job is failed.
Is there anyway to tell argo to continue the workflow/output an empty string when the resource is not found. I believe the output artifact simply generates an empty tar ball when no resource is found.

Environment:

  • Argo version:
    v2.1.1
  • Kubernetes version :
    Client: 1.11
    Server: 1.9+

Other debugging information (if applicable):

  • workflow result from argo get:
    failed to save outputs: exit status 2
@gaoning777 gaoning777 changed the title Absence of output.parameters resource leading to job failure Absence of output.parameters resource leading to the whole job failure Aug 16, 2018
@gaoning777
Copy link
Author

@yebrahim

@jessesuen
Copy link
Member

This is essentially the same issue as #897. Will duplicate and target this for v2.2

@jessesuen
Copy link
Member

When hello.json is not output in the container, the whole job is failed.
Is there anyway to tell argo to continue the workflow/output an empty string when the resource is > not found. I believe the output artifact simply generates an empty tar ball when no resource is found.

Actually reading it closer, @gaoning777 i think we are on opposite ends of what we feel is the right behavior.

I believe the output artifact simply generates an empty tar ball when no resource is found.

This is not ideal. For artifacts, the desired behavior is that if someone specifies an artifact path which doesn't exist, then it is considered a user error. Bug #897 is about the fact that we continue down the workflow even though the artifact path does not exist.

For parameters, I think this is also the right behavior, which according to your observations, is already happening for parameters.

One thing we might consider is having default values for output parameters. So if you have the following:

outputs:
  parameters:
  - name: hello
    default: ''
    valueFrom:
      path: /hello.json

if /hello.json does not exist, then we would return empty string, which I think addresses your use case.

@gaoning777
Copy link
Author

In terms of workflow continuing when the artifact path is not found, I think it is reasonable to continue the workflow because the correctness of the whole workflow might not depend on the existence of a certain artifact. Users might simply want to output an artifact for some other purposes. Take a step back, it might make sense to make it configurable whether users want the workflow to stop if no artifacts are found.

@vicaire
Copy link

vicaire commented Aug 16, 2018

jessesuen@, yes I think that would solve the problem. Thanks!

@jessesuen
Copy link
Member

@gaoning777 reopening because if we allow default values for outputs, then it should satisfy yours and @vicaire's request. I think this is a reasonable request.

@jessesuen jessesuen reopened this Aug 17, 2018
@jessesuen jessesuen changed the title Absence of output.parameters resource leading to the whole job failure Allow optional output parameters by specifying a default value Aug 17, 2018
@gaoning777
Copy link
Author

Oh, right, this is to-be-added feature.
I thought the default is already supported in output parameters.
Thanks jessesuen

@jessesuen
Copy link
Member

This should be now doable with PR: #1277

@cccdy
Copy link

cccdy commented Nov 12, 2019

hi,@jessesuen i also have a similar problem, i want to pass some failed log messages to global output, so that other container can access the log messages. i follow your advice for default value,but it still fails with “failed to save outputs: exit status 2”. the yaml snippet is as follows,waiting for your help,thanks!
outputs:
parameters:
- name: error-msg
default: ""
valueFrom:
path: /tmp/error.txt
globalName: global-error

icecoffee531 pushed a commit to icecoffee531/argo-workflows that referenced this issue Jan 5, 2022
* feat: Add string comparators EqualTo and NotEqualTo

Signed-off-by: Javier Salinas <jsalinaspolo@gmail.com>

* Use regex for match for EqualTo or NotEqualTo in String comparator

Signed-off-by: Javier Salinas <jsalinaspolo@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants