Closed bendnorman closed 2 years ago
Another potential benefit of Prefect is generating an explicit set of dependencies between different products. This could help with debugging and understanding what parts of the overall system are affected by changes. It could also allow us to re-run only those parts of the data processing that need to be re-run to generate new outputs, based on what's been changed.
The pre-database set of dependencies isn't super complex at the moment, but as the data get recombined in more complex ways further downstream it seems hard to keep track of what changes impact which other parts.
Also, as we get more datasets that are unrelated to each other -- at least early on in the pipeline -- being able to process them in parallel should speed things up considerably. There's no reason for the early stages of the EIA 860/861/923/176 or FERC 1/2/EQR or PHMSA data to have to wait on each other. They should all be able to run in parallel until you get to the steps where they're interacting (e.g. entity resolution for EIA data).
Good point, Prefect produces very useful visual documentation of dependencies.
The pre-database set of dependencies isn't super complex at the moment, but as the data get recombined in more complex ways further downstream it seems hard to keep track of what changes impact which other parts.
Are you referring to output and analysis tables? If so, using prefect to orchestrate the creation of those tables makes sense.
Not to throw a wrench in this decision but I spent some time reading about another python orchestration tool called Dagster. It seems much more data engineering focused where as Prefect tries to be as flexible as possible.
Was Dagster ever considered when we set out to parallelize our ETL? If so, why did we choose Prefect instead?
I’ve highlighted some interesting features that I don’t think Prefect addresses.
Are you referring to output and analysis tables? If so, using prefect to orchestrate the creation of those tables makes sense.
Yes, the MCOE, the Plant Plarts Plist, the fuzzily-merged FERC+EIA data, the utility + balancing authority service territories, the hourly state-level electricity demand, etc -- basically any "stock" analysis that we create that generates a generally useful tabular output should eventually be getting written to a DB, so that anyone can use it without need to run code -- they can just install it using one of the data catalogs.
A good video overview of Dagster.
After spending an hour with the tutorial and video walkthrough it seems really similar to Prefect, but with stronger opinions and more defined structures. But those opinions and structures seem to be pretty directly aimed at our patterns of use.
Another think I liked was how easy they made it seem to swap out local disk, database, or object store persistence, so testing, CI, cloud versions of the same run could all be easily done only swapping out the persistence layer / objects.
I like the focus on typing, enumerating, validating, tracking of the assets that are produced as much as or even more than the DAG itself. They seem more like a necessary glue in Prefect, but not a focus.
The tracking of how assets evolve over time is also attractive -- being able to see how the number of rows in a table has changed, and the schema of the table would be really useful.
What I really want is an opinionated tool for our use case with good opinions since left to our own devices we'll probably come up with bad opinions, since we aren't experts.
Another thing I liked was the ability to swap out different persistence layers so that local testing / CI / deployment can use the same data processing code, with the saving of assets decoupled from the rest of the system.
We have decided to move forward with Dagster. See epic #1487 for the full reasoning.
This issue is to discuss how we want to the work in the Prefect branch #901 in.
Questions
1. What are our top infrastructure issues? Does the Prefect branch get us closer or further to addressing those issues? Some of these issues are being enumerated in #1401.
Here are a couple of our issues and how the prefect branch addresses them:
pd.read_excel()
. Given the raw excel files do not change, caching this extraction step and any other long-running processing tasks would dramatically speed up development and testing.@task(checkpoint=False)
parameter for transformation tasks (all downstream tasks will also not be cached). This is a bit awkward right now but it's a step in the right direction.DatasetPipeline
. The class requires you to implement the dataset settings and abuild()
method that adds processing tasks to the main flow. I think this is a decent start and could be expanded. Maybe instead of having a catch-all build method, a pipeline should implement extract, transform and load methods? The questions regarding how to extract data and where to apply transformations are not addressed by the branch.2. If we are to merge the prefect branch in, what would be the next steps?