L godlike
07/31/2023, 2:06 PM@workflow
def my_wf() -> str:
print("@@@ i am in")
res = say_hello()
return res
if I execute it locally,
@@@ i am in
@@@ i am in
Will appear in my terminal
Can anyone explain why or guide me some reference ?
Thanks a lot !Pryce
07/31/2023, 2:25 PMsay_hello
also has the same print statement in it?L godlike
07/31/2023, 2:26 PMHank Huang
07/31/2023, 2:35 PMPryce
07/31/2023, 2:42 PMsay_hello
?Hank Huang
07/31/2023, 3:03 PMdef say_hello():
return "hello"
@workflow
def my_wf() -> str:
print("@@@ i am in")
res = say_hello()
return res
my_wf()
Pryce
07/31/2023, 3:04 PMpyflyte run
?Hank Huang
07/31/2023, 3:04 PMYicheng Lu
07/31/2023, 3:04 PMPryce
07/31/2023, 3:05 PMmy_wf()
it should work as expectedYicheng Lu
07/31/2023, 3:05 PMres
, the first print will be promise, the second print will be flytekit literal.Hank Huang
07/31/2023, 3:12 PM@workflow
def my_wf() -> str:
print("@@@ i am in")
res = say_hello()
print(type(res))
return res
print(my_wf())
Yicheng Lu
07/31/2023, 3:15 PMHank Huang
07/31/2023, 3:15 PM@@@ i am in
<class 'str'>
@@@ i am in
<class 'str'>
hello
Yicheng Lu
07/31/2023, 3:16 PMHank Huang
07/31/2023, 3:17 PM@@@ i am in
hello
@@@ i am in
hello
hello
Not sure if it’s related to the env I runPryce
07/31/2023, 3:20 PMpython
or pyflyte run
. But otherwise expected.. if you remove the ()
from print(my_wf())
you should only get one print loop.Hank Huang
07/31/2023, 3:21 PM@task
def say_hello()->str:
return "hello"
we should @ task@@@ i am in
Promise(node:n0.o0)
@@@ i am in
Resolved(o0=<FlyteLiteral scalar { primitive { string_value: "hello" } }>)
hello
Does these are the expected result? @Yicheng Lu @PryceYicheng Lu
07/31/2023, 3:22 PMPryce
07/31/2023, 3:23 PMHank Huang
07/31/2023, 3:23 PMPryce
07/31/2023, 3:26 PMHank Huang
07/31/2023, 3:26 PMPryce
07/31/2023, 3:27 PMpyflyte run
vs python
section here that describes the different ways of running locally, if you haven't seen it yet.. https://docs.flyte.org/projects/cookbook/en/latest/index.htmlHank Huang
07/31/2023, 3:28 PMPryce
07/31/2023, 3:28 PMKevin Su
07/31/2023, 4:00 PML godlike
08/01/2023, 12:57 AM