Summary
Running tasks conditionally and filtering results in Prefect 2.0 is now effectively the same as normal Python, where we don’t need special Prefect tasks like FilterTask
or the case
block.
Audience
This is applicable for all users of Prefect 2.0 who may be familiar with writing Prefect 1.0 workflows that branch conditionally or filter results.
What is Staying the Same?
The way we define our tasks
What is different
- We can use normal
if
blocks instead of thewith case
block - We can use the standard library
filter
expression to filter results instead of the PrefectFilterTask
since in Prefect 2.0, we can materialize task results directly in the flow context