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 2022/09/16 03:37:52 UTC

[GitHub] [airflow] uranusjr commented on a diff in pull request #26342: Don't update backfill run from the scheduler

uranusjr commented on code in PR #26342:
URL: https://github.com/apache/airflow/pull/26342#discussion_r972584572


##########
airflow/jobs/scheduler_job.py:
##########
@@ -784,7 +785,15 @@ def _update_dag_run_state_for_paused_dags(self) -> None:
                 dag = SerializedDagModel.get_dag(dag_id)
                 if dag is None:
                     continue
-                dag_runs = DagRun.find(dag_id=dag_id, state=DagRunState.RUNNING)
+                dag_runs = (
+                    session.query(DagRun)
+                    .filter(
+                        DagRun.dag_id == dag_id,
+                        DagRun.state == DagRunState.RUNNING,
+                        DagRun.run_type != DagRunType.BACKFILL_JOB,
+                    )
+                    .all()

Review Comment:
   ```suggestion
   ```
   
   The query object is iterable and `all()` here creates a list unnecessarily.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org