Tomas Moreno
12/04/2024, 9:19 PM.map()
? do I need to pass unmapped to my args in wait_for?Marvin
12/04/2024, 9:19 PMwait_for
when using the .map()
function in Prefect. Mapping in Prefect creates individual task runs for each element in the input data. If your mapped function needs to wait for a previous task to complete, you can specify this with wait_for
.
Regarding your second question: when using wait_for
in conjunction with .map()
, if you want to provide a static value (i.e., a value that shouldn’t be iterated over) to your tasks, you would indeed use unmapped
. The unmapped
function wraps your static argument to ensure that it's treated as a constant across all mapped tasks rather than being iterated.
Here are some docs that cover these concepts in both Prefect 2.x and 3.x:
- For Prefect 3.x, the idea of using .map()
for handling iterables and the use of unmapped
for static values is discussed in this document.
- A similar explanation for Prefect 2.x can be found here, highlighting examples of task mapping and handling static arguments.
Let me know if there's anything else you'd like to unravel from the depths of this automation galaxy!Nate
12/04/2024, 9:20 PMwait_for
does not need to be annotated with unmapped
unmapped is only for arguments to map
that you do not want to map overTomas Moreno
12/04/2024, 9:21 PM