# ask-the-community

Wu Da-Yi

10/18/2023, 9:47 AM
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 ( that create a task and a workflow with print hello at the first. However, I found that
pyflyte run 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")
def task_b():
    print ("b")
def my_wf():
    t2 = task_b()

Jay Ganbat

10/18/2023, 3:44 PM
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

David Espejo (he/him)

10/19/2023, 3:45 PM
@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
are printed