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:
[email protected]
With regards,
Apache Git Services