Hi! Is it possible when creating imperative workfl...
# ask-the-community
j
Hi! Is it possible when creating imperative workflows to assign default values to the input parameters, similar to when doing Python function workflows? That is, how to express
Copy code
@workflow
def simple_test(a: str = "hello"):
    ...
when doing
Copy code
workflow = Workflow(name="simple_test_imperative")
a_param = workflow.add_workflow_input("a", str)  # How to set default value "hello"?
Is this possible?
k
Yes, default values are actually only added to launchplans. When you create a workflow a default launchplan is automatically created and allows you to add default values
I will have to take a look of the automatic launchplan creation logic is added to imperative workflow, but you can always create a launchplan with no name
And it will achieve what you want
j
ah okay. yeah, that's what I did - but unfortunately the automatically created default launch plan don't provide default values (I think?!) so I'm currently creating another launch plan - as the default one can't be modified, which seems non-ideal. I get more Flyte objects and it's somewhat confusing
k
Ok, let’s add support For default values
I like your interface- should be simple
Want to make a PR?
j
I'm not super familiar with the Flyte code itself, even though for this particular case I went somewhat deep for debugging purposes. it might take a while; as I said, I have a working workaround, even though I don't like it very much (I'm building a thin layer on top of the Flyte workflows to make things even easier for our users who often are not data engineers)
k
Let me see if I can add it quickly
j
but good to know that the default values comes from the default launch plan, no need for me to look into it deeper 🙂
k
But an issue will help
j
where can I create the issue? (sorry, I'm a n00b in this community)
k
I think you can update the default launchplan too
[flyte-issue]
Weird that did not work
j
tbh it was a couple of months ago I tried that, and I just remember that I got some error message about default launch plans not supporting default values - or something of the sort. at that time I knew even less of Flyte so didn't think much about it, but perhaps I misunderstood something. will take a closer look at updating the default launch plan - thanks!
k
You can before you create in the back - I.e before you register https://github.com/flyteorg/flyte
Issues
Also star the repo ❤️
k
[flyte-core]
k
Aah my bad