Hello! I was wondering if its possible to modify w...
# ask-the-community
j
Hello! I was wondering if its possible to modify workflow parameters outside of a task like this:
Copy code
@task
def print_stuff(input: str):
    print(input)

@workflow
def wf1(test: str = "test"):
    print_stuff(input=f"hello {test}")
Since
test
is a Promise in that context i am getting weird prints. Is there a way to extract the string value?
f
Only in a @dynamic workflow
j
Thanks 🙏 Looks like dynamic workflows are the way to go for a lot of use cases
y
so workflow code look like python but it’s really more of a dsl.
at run time, the all the tasks are overloaded to return promise objects instead
so if you run that example, at compile time, i think what you would get is a statically bound string of “hello Promise<…>”
dynamic tasks are workflows that are not compiled until run-time.
basically if you say to yourself, i don’t know what the structure of the workflow will be until i know the inputs, then you definitely want a dynamic task.
a more concrete example
Copy code
@workflow
def wf(a: int)
   for i in range(a): ... # this fails.

@dynamic
def dwf(a: int)
   for i in range(a): ... # this succeeds.

# however tasks in a dynamic task still produce promises
@dynamic
def dwf()
   a = task_that_produces_an_int()
   for i in range(a): ... # this still fails.
in your case however, can you not
test
as a separate input to the task?
j
Thanks for making this clear!
For my example i wanted to modify the string before putting it into an input of the type FlyteFile. I think in this case i cannot do it inside of the task.
154 Views