Open CodingOrca opened 2 years ago
{}
is not a string. Have you tried setting supplied
to the default value?
You mean, something like this?
outputs:
parameters:
- name: message
valueFrom:
supplied: "default"
If I do this, and try to create such a workflow, I get this error: Error: Could not create Workflow: . . . . v1alpha1.Parameter.ValueFrom: v1alpha1.ValueFrom.Supplied: skipObjectDecoder: expect object or null, error found in #10 byte of ...|supplied\":\"default\"}|..., bigger context ...|eters\":[{\"name\":\"message\",\"valueFrom\":{\"supplied\":\"default\"}}]},\"suspend\":{\"duration\":\"6\"}}],\"ttlStr|..."}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@CodingOrca Did you manage to get around this somehow? I have a very similar use case and this is currently blocking me, too.
@alexec Any updates or remarks on @CodingOrca last comment? Would you please, provide a simple example how to provide defaults for the supplied value?
I also tried:
supplied: {"foo": "bar"}
But unfortunately, it didn't work either. It even got ignored from the manifest. When I check the manifest from the UI after submitting using kubectl apply, I see this:
supplied: {}
(as if anything between the curly braces is completely ignored)
OK. I was wrong. You cannot use supplied.
I don't think this is a bug, it is an enhancement.
If anyone is interesting submitting a PR, I give pointers .
@alexec Any tips in the meantime to circumvent the issue of distinguishing whether a previous suspend step's output has been supplied? I am under a bit of a time pressure :D
I also posted a question here: https://github.com/argoproj/argo-workflows/discussions/8248
I don't think this is a bug, it is an enhancement.
If anyone is interesting submitting a PR, I give pointers .
@alexec I am sorry but I super respectfully disagree. I see this as a bug because if the default value is supported for the output parameters, then it should work for all kinds of output parameters, not just some of them. It would be an enhancement if we can live without it or if there's any workaround to the topic of distinguishing whether the workflow has resumed automatically or not. Your call though of course. I trust your judgement and I might be mistaken.
@alexec Any tips in the meantime to circumvent the issue of distinguishing whether a previous suspend step's output has been supplied? I am under a bit of a time pressure :D
Okay, I know I am not alexec... but I use as work around another suspend, with delay, but with no output, from where I trigger the resume of the my own workflow... so that my "approve" suspend gets resumed. If it is resumed like this, the configured default is taken:
. . .
templates:
- name: main
dag:
tasks:
- name: waitForSeconds
template: waitForSeconds
arguments:
parameters:
- name: delay
value: 60
- name: resumeWorkflow
dependencies: [waitForSeconds]
template: resumeWorkflow
- name: approve
template: approve
. . .
- name: waitForSeconds
inputs:
parameters:
- name: delay
suspend:
duration: "{{inputs.parameters.delay}}"
- name: resumeWorkflow
http:
method: "PUT"
url: "http://argo-server.argo-workflows:2746/api/v1/workflows/kondor-workflow/{{workflow.name}}/resume"
- name: approve
suspend: {}
outputs:
parameters:
- name: message
valueFrom:
default: "some default value"
supplied: {}
@CodingOrca Thanks for the hint. I tried your example and it did indeed take the defaults. I started wondering why is it that it works in that example (but not when I tried resuming through the API call from Postman, for example). I just managed to isolate the problem just now. For me, I noticed that the default value gets sets only when all of the following is true:
Adding the nodeFieldSelector to the resume request breaks it and the default gets ignored. This one really surprised me.
@alexec This information might be useful if someone ever attempts to fix this. Just FYI.
I think I can point to where the bug is:
ResumeWorkflow
call a different func if there is a nodeFieldSelector
. If there is not one, it takes into account defaults:
But if there is one, they are not taken into account:
I think the block of code doing defaults should be copied and pasted into the second location.
Would anyone like to submit a PR for this? It's by far the fastest way to fix bugs. The core team won't look at this anytime soon.
Hello, i am exactly same issue. Any advance to fix it?
@alexec I will try to submit a PR to fix this since I am right now blocked on this.
Discussed in https://github.com/argoproj/argo-workflows/discussions/7905
I am using argo workflows v3.3.0-rc4, and need a way to distinguish after a suspend step if its output parameter was supplied with a value per API and then resumed, or if the configured duration expired. Currently this is not possible: