You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/02/26 09:10:02 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #7502: [AIRFLOW-6881][depends on AIRFLOW-6869][WIP] Bulk fetch DAGRun for create_dag_run

mik-laj commented on a change in pull request #7502: [AIRFLOW-6881][depends on AIRFLOW-6869][WIP] Bulk fetch DAGRun for create_dag_run
URL: https://github.com/apache/airflow/pull/7502#discussion_r384358607
 
 

 ##########
 File path: airflow/jobs/scheduler_job.py
 ##########
 @@ -498,19 +499,26 @@ def update_import_errors(session, dagbag):
         session.commit()
 
     @provide_session
-    def create_dag_run(self, dag, session=None):
+    def create_dag_run(self, dag, dag_runs=None, session=None):
         """
         This method checks whether a new DagRun needs to be created
         for a DAG based on scheduling interval.
         Returns DagRun if one is scheduled. Otherwise returns None.
         """
         if dag.schedule_interval and conf.getboolean('scheduler', 'USE_JOB_SCHEDULE'):
-            active_runs = DagRun.find(
-                dag_id=dag.dag_id,
-                state=State.RUNNING,
-                external_trigger=False,
-                session=session
-            )
+            if dag_runs is None:
 
 Review comment:
   I did this to facilitate testing of this method both in unit tests and in performance tests. 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services