dbx icon indicating copy to clipboard operation
dbx copied to clipboard

Dynamic passing parameters

Open goldstein0101 opened this issue 3 years ago • 2 comments
trafficstars

Hey, lets say that i have 5 parameters of task for workflow inside deployment.yaml When i want to use dbx execute with --parameters, is there a way for me to just change one of them, while others take values from deployment.yaml. Beacuse if i use --parameters='{"parameters": ["argument1", "argument2"]}' or --parameters='{"named_parameters": ["--a=1","--b=2"]}', its going to replace all arguments by those provided with --parameters.

goldstein0101 avatar Nov 05 '22 21:11 goldstein0101

hi @goldstein0101 , this looks to me like a feature request, not sure how to implement it in the best possible way considering the fact that there are various designs for parameters depending on the API used.

renardeinside avatar Nov 06 '22 11:11 renardeinside

Probably too late for this, but for anybody else looking for a workaround one could use jinja variables for all of the required parameters in the deployment.yml and include default values. Example:

              parameters: ["{{var['VAR1_VALUE'] | default('v1')}}", "{{var['VAR2_VALUE'] | default('v2')}}",...,"{{var['VAR5_KEY'] | default('v5')}}"]

Specify only the replacements in a separate yaml variables file. For the above example, you could write a file 'my_vars.yml' with the following contents:

VAR1_VALUE="my_v1"
VAR2_VALUE="my_v2"

Then run dbx execute ... --jinja-variables-file=<path/to/my_vars.yml>, which would swap out default parameters for only those parameters defined in the yaml file.

sfwatergit avatar Jan 24 '23 03:01 sfwatergit