I am trying to create Dynamic DAGs and then get them to the scheduler. I tried the reference from https://www.astronomer.io/guides/dynamically-generating-dags/ which works w
I guess doing the following would fix it
testDynDags dag and tst_dyn_dags task (instantiation and invocation)fetch_new_dags(..) method with requisite arguments in global scopeExplanation
So clearly, wrapping dag-generation code inside an Airflow task itself makes no sense.
UPDATE-1
From what is indicated in comments, I infer that the requirement dictates that you revise your external source that feeds inputs (how many dags or tasks to create) to your DAG / task-generation script. While this is indeed a complex use-case, but a simple way to achieve this is to create 2 separate DAGs.
You can take inspiration from the Adding DAGs based on Variable value section