Replies: 3 comments 1 reply
-
I'm not experienced with Argo alot, but browsing to the provided examples my understanding is that withParam is used when the values are produced from different template within the workflow. Not 100% sure though |
Beta Was this translation helpful? Give feedback.
-
I was Googling this question just now, and found my old question! I still don't have a great understanding, but for the sake of posterity, the main difference seems to be:
|
Beta Was this translation helpful? Give feedback.
-
@max-sixty @DimitrisSotiriou @padrepitufo The main differences between Data source:
Use case:
This functional workflow demonstrates both apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: withitems-withparam-random-
namespace: argo
spec:
templates:
- name: main
steps:
- - name: generate-random-list
template: random-list-generator
- - name: withitems-example
template: print-message
arguments:
parameters:
- name: message
value: '{{item}}'
withItems:
- Hello
- World
- - name: withparam-example
template: print-message
arguments:
parameters:
- name: message
value: '{{item}}'
withParam: '{{steps.generate-random-list.outputs.result}}'
- name: random-list-generator
script:
name: ''
image: python:alpine3.6
command:
- python
source: |
import json
import random
import string
def random_string(length):
return ''.join(random.choices(string.ascii_lowercase, k=length))
num_strings = random.randint(3, 10)
random_list = [random_string(5) for _ in range(num_strings)]
print(json.dumps(random_list))
- name: print-message
inputs:
parameters:
- name: message
container:
name: ''
image: alpine:3.14
command:
- echo
args:
- '{{inputs.parameters.message}}'
entrypoint: main Resources:
|
Beta Was this translation helpful? Give feedback.
-
I became very confused when working through some parallelization, and I wanted to confirm my understanding and offer some guidance for others who might get confused.
Since working through a
withParam
workflow, IIUC,withParam
is not the same aswithItems
in that:withItems
creates n tasks for both that task and any of its dependencies.withParam
creates n tasks for only that task. Its dependencies will have a count of 1 regardless of how many instances of the original task are created (unless they create multiple instances of themselves usingwithItems
orwithParam
.Is this correct?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions