https://prefect.io logo
f

Fabrice Toussaint

02/07/2022, 2:33 PM
Hi all, I got a question regarding the `apply_map`function of Prefect. Is it possible to run this from within a task as well, as I am getting the following error:
Copy code
ValueError("Couldn't infer a flow in the current context")
k

Kevin Kho

02/07/2022, 2:42 PM
Basically
apply_map
unpacks all of the tasks inside and adds them to the Flow, so I don’t think it can be used inside a task because that would imply a task inside a task
f

Fabrice Toussaint

02/07/2022, 3:11 PM
Is there a way to apply_map to an apply_map?
k

Kevin Kho

02/07/2022, 3:21 PM
I am not 100% sure, but I think so. Think of
apply_map
as a native Python function that outputs tasks, but you can’t have non-task stuff like
if-else
inside. So it’s hard for me to visualize how this would work.
6 Views