https://prefect.io logo
k

Khari Gardner

08/06/2023, 9:17 PM
Rough shot in the dark. Looking for a way to compile YAML into Prefect flows (building a Data platform) From what I've seen, the class based flow building isn't really supported or recommended in Prefect, so I've resorted to basically using Jinja2. Is my presumption incorrect regarding the class based flow and task creation?
n

Nate

08/06/2023, 10:01 PM
hi @Khari Gardner - I suppose it depends what exactly you mean by compile yaml into prefect flows, but we currently define prefect deployments as yaml if by
the class based flow building isn't really supported or recommended in Prefect
you mean the imperative api from prefect 1 where you could say
Flow.add_task()
etc then you're correct, since the execution graph is discovered at runtime in prefect 2 (no DAG up front) how exactly are you trying to go from yaml to prefect flows?
k

Khari Gardner

08/07/2023, 2:14 AM
My original plan was to use the class based setup and fork this repository and make modifications to fit Prefect DagFactory - Github . But I also wanted to be able to inspect the Flows and decouple the compilation from running Prefect UI, to make modifications and testing a little easier. That is when I decided to go with Jinja2. The overarching design is to have Blocks & predefined transformations and utilities that a less Pythonically inclined data platform user can just add to a YAML describing the transformations needed to get from A -> B. Python will parse the YAML using Omegaconf among other utilities to fill in Jinja templates for set types of transformations, ingestions, and ddls with the Blocks.