mik-laj commented on issue #7502: [AIRFLOW-6881][depends on AIRFLOW-6869][WIP] 
Bulk fetch DAGRun for create_dag_run
URL: https://github.com/apache/airflow/pull/7502#issuecomment-589997296
 
 
   ```
   from datetime import timedelta
   
   from airflow.models import DAG
   from airflow.operators.dummy_operator import DummyOperator
   from airflow.utils.dates import days_ago
   
   args = {
       'owner': 'airflow',
       'start_date': days_ago(3),
   }
   
   def create_dag(dag_number):
       dag = DAG(
           dag_id=f'perf_50_dag_dummy_tasks_{dag_number}_of_50', 
default_args=args,
           schedule_interval="@once",
           dagrun_timeout=timedelta(minutes=60),
           is_paused_upon_creation=False,
       )
   
       for j in range(1, 100):
           DummyOperator(
               task_id='task_{}_of_5'.format(j),
               dag=dag
           )
   
       return dag
   
   for i in range(1, 20):
       globals()[f"dag_{i}"] = create_dag(i)
   
   ```
   Before:
   Query count:  249
   Retry took 1333.755 ms
   
   After:
   Query count:  230
   Retry took 1267.842 ms
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to