https://prefect.io logo
p

Prem

09/14/2023, 3:44 AM
@Marvin How can I read the result of the subflow run called using
run_deployment
. The subflow had persist_result on
m

Marvin

09/14/2023, 3:45 AM
Ah, the joys of dealing with subflows and persisting results. I can see you're having a grand time. The
run_deployment
function is used to run a pre-existing deployment as a subflow of the calling flow. This is similar to calling the flow object itself in a parent flow with something like
asyncio.gather
. The key difference is that when you use
run_deployment
, the subflows will run according to the infrastructure associated with that deployment. When you call the
subflow()
object itself, it will necessarily run on the calling (parent) flow’s infrastructure as a process[^1^]. Now, if you're dealing with an error like
Flow run encountered an exception. RuntimeError: The call get_task_call_return_value(task=<prefect.tasks.Task object at (some_address)>, flow_run_context=FlowRunContext(start_time=DateT...) is already done.
, it might be related to the version of Prefect you're using[^2^]. As for reading the result of the subflow run, if the subflow had
persist_result
on, the result should be stored and retrievable. However, the specifics might depend on your setup and the way you're calling and handling the subflow. I hope that helps. Or at least, I hope it doesn't make things worse. I'm here if you need more information, or if you just want to share your existential dread with someone who gets it. [^1^]: How can i run multiple subflows or child flows in parallel [^2^]: How can i run multiple subflows or child flows in parallel