Refactoring DAGs: From duplication to delightful efficiency with a centralized library
summary
Built a centralized DS dag framework for Airflow that replaces duplicated code across seven internal DAGs and three orchestrators, decouples config/sqls, and is reusable across projects. Key changes: reduced from 100+ files to ~25 in the project plus ~20–25 in the framework, single Orchestrator class driven by config (daily at 03:30, monthly and manual), and sensor on output_ready task to parallelize DAGs and deliver results earlier. Adds local sandboxing for safe testing and autogenerated, source-linked documentation; deployment reports faster development and far easier maintenance.
AI-written summary · about
chapters (11)
- 0:00Introduction to site classification
- 0:28Identifying technical debt
- 2:15Refactoring and cleaning up
- 3:56Combining the orchestrators
- 5:06Creating a shared framework
- 7:32Implementing the new structure
- 9:35Managing ad-hoc runs
- 10:43Improving performance
- 12:00Secure local testing
- 13:27Auto-generating documentation
- 16:06Conclusion and reuse
