Code reuse with Dags
See original GitHub issueI’d like clone a dag multiple times to replicate the logic for multiple similar markets/sources.
I drive most of my dag configuration by pulling json Variables
to parametrize values, so having configuration for each market isnt a problem. My problem is actually cloning the dag+tasks without actually having two seperate scripts containing the same code (albeit with different dag names).
Is this possible or does it go against the design pattern of aiflow dags?
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Assign airflow task to several DAGs - Stack Overflow
I wonder if there is any other approach to reuse an existing airflow task assign to a different dag. I am using apache-airflow[docker,kubernetes]== ......
Read more >Re: reuse dags - The Mail Archive
I am looking for a built-in simple way to > import dags. > > Reusing and factorizing code is quite common need.
Read more >Dynamically generating DAGs in Airflow - Astronomer Docs
Get to know the best ways to dynamically generate DAGs in Apache Airflow. Use examples to generate DAGs using single- and multiple-file methods....
Read more >Best Practices - Apache Airflow
Creating a new DAG is a three-step process: writing Python code to create a DAG object,. testing if the code meets our expectations,....
Read more >Code reuse - Wikipedia
In software development code reuse, also called software reuse, is the use of existing software, or software knowledge, to build new software, :...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For folks generating multiple dags in a script, maybe a
DagContainer
object (which is just a list subclass) would be nice… then in addition to any DAG objects found in a script, anything in any DagContainers is also imported. Not sure how many people are actually doing this but I know it’s come up a few times.It’s actually probably cleaner to write a function or a class that generates dag objects base on input parameters