damp-lion-88352
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 !loud-belgium-4006
07/31/2023, 2:25 PMsay_hello
also has the same print statement in it?damp-lion-88352
07/31/2023, 2:26 PMrefined-doctor-1380
07/31/2023, 2:35 PMloud-belgium-4006
07/31/2023, 2:42 PMsay_hello
?refined-doctor-1380
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()
loud-belgium-4006
07/31/2023, 3:04 PMpyflyte run
?refined-doctor-1380
07/31/2023, 3:04 PMacceptable-window-92672
07/31/2023, 3:04 PMloud-belgium-4006
07/31/2023, 3:05 PMmy_wf()
it should work as expectedacceptable-window-92672
07/31/2023, 3:05 PMres
, the first print will be promise, the second print will be flytekit literal.refined-doctor-1380
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())
acceptable-window-92672
07/31/2023, 3:15 PMrefined-doctor-1380
07/31/2023, 3:15 PM@@@ i am in
<class 'str'>
@@@ i am in
<class 'str'>
hello
acceptable-window-92672
07/31/2023, 3:16 PMrefined-doctor-1380
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 runloud-belgium-4006
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.refined-doctor-1380
07/31/2023, 3:21 PMrefined-doctor-1380
07/31/2023, 3:21 PM@task
def say_hello()->str:
return "hello"
we should @ taskrefined-doctor-1380
07/31/2023, 3:21 PMrefined-doctor-1380
07/31/2023, 3:22 PM@@@ 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? @acceptable-window-92672 @loud-belgium-4006acceptable-window-92672
07/31/2023, 3:22 PMloud-belgium-4006
07/31/2023, 3:23 PMrefined-doctor-1380
07/31/2023, 3:23 PMloud-belgium-4006
07/31/2023, 3:26 PMrefined-doctor-1380
07/31/2023, 3:26 PMloud-belgium-4006
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.htmlrefined-doctor-1380
07/31/2023, 3:28 PMloud-belgium-4006
07/31/2023, 3:28 PMglamorous-carpet-83516
07/31/2023, 4:00 PMdamp-lion-88352
08/01/2023, 12:57 AM