Hi community, I am a MLE trying to get familiar on...
# ask-the-community
w
Hi community, I am a MLE trying to get familiar on flyte/flytekit. I have a question on the mechanism of pyflyte. Following is a very simple code (test.py) that create a task and a workflow with print hello at the first. However, I found that
python test.py
and
pyflyte run test.py my_wf
give me different output. 1. python: print "hello" for 4 times --> why?? 2. pyflyte: work normally. print one time hello and output "b" Can anyone have a very brief explain on this?
Copy code
from flytekit import task ,workflow#, task, dynamic, LaunchPlan, ExecutionParameters
print ("hello")
@task
def task_b():
    print ("b")
@workflow
def my_wf():
    t2 = task_b()
j
why are you putting bare statement in python code? if its just python then i think flyte is doing local execution and for that workflow is getting compiled once at least so that explains the multiple print hello but im not sure it explains all 4
d
@Wu Da-Yi I get the same outcome as you. What i know so far is that the code that's not inside the @workflow annotation is compiled by the Python interpreter itself while the code inside the workflow is handled as a DSL where Flyte generates an execution graph without actually executing the code. Unfortunately, I still don't get why 4
hello
are printed