Hi everyone, I have a general question. What’s the...
# ask-community
l
Hi everyone, I have a general question. What’s the difference between calling a Python function from a flow vs wrapping the function to a task?
1
n
hi @Liz a couple key differences: • when you use tasks in a flow ◦ the task decorated function will create a task run (via prefect API) before running your defined function, so the state of the execution can be tracked / reported ◦ references to results (the
return
) from your task-decorated function are tracked so that you can
wait_for
certain results when calling downstream tasks ◦ if you configured results, we will save / serialize the
return
of that function to your desired storage location ◦ your function will be executed in a worker thread, not the main thread • when running a normal function in a flow ◦ none of the above happens, everything is just like normal python
💡 4
l
Thank you Nate
🦜 1