How to use non-default parameters when submitting a Workflow #1460
-
Argo allows submitting a workflow with parameters set to non-default values: https://argo-workflows.readthedocs.io/en/latest/walk-through/parameters/ How can you do this with Hera? I looked through most of the I've got a solution that works by using a factory function to take my parameter inputs and generate a brand new workflow with those inserted as the default parameter values, but that seems silly. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @rgasper! At the moment the way to this is to set the values by the # my_workflow.py
from hera.workflows import Workflow, script
@script()
def hello(s: str):
print("Hello, {s}!".format(s=s))
with Workflow(
generate_name="hello-world-",
entrypoint="hello",
arguments={"s": "world"},
) as w:
hello() Then you can import it and do # submit_script.py
from my_workflow import w
w.arguments = {"s": "Hera"}
w.create() I think adding an |
Beta Was this translation helpful? Give feedback.
Hi @rgasper! At the moment the way to this is to set the values by the
arguments
on theWorkflow
. E.g. if you have a workflow likeThen you can import it and do
I think adding an
arguments
parameter to thecreate
function makes sense though to make this use case a one-liner (actually this should accept most if not all theWorkflow
attributes, then you coul…