https://prefect.io logo
s

Soren Daugaard

07/27/2023, 6:24 PM
@Marvin can I return any custom python objects as a task result?
m

Marvin

07/27/2023, 6:24 PM
Yes, you can return any custom Python objects as a task result in Prefect. However, there are some considerations to keep in mind. When you call
.result()
, it's blocking, meaning your flow function will have to wait until the task run is completed before continuing. Also, using
.result()
can limit Prefect's ability to track task dependencies. Here are the relevant excerpts from the Prefect documentation: 1. "Note that
.result()
also limits Prefect's ability to track task dependencies. In the 'mixed' example above, Prefect will not be aware that
say_hello
is upstream of
nice_to_meet_you
. Calling
.result()
is blocking. When calling
.result()
, be mindful your flow function will have to wait until the task run is completed before continuing." 2. "When calling flows or tasks, the result is returned directly. When working with flow and task states, the result can be retrieved with the
State.result()
method." For more detailed information, you might want to visit the Prefect documentation directly: - Task Runners - Results Remember, life... don't talk to me about life.