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/04/09 18:28:27 UTC

[GitHub] [airflow] turbaszek commented on a change in pull request #8232: Simplify DAG.set_dag_runs_state method

turbaszek commented on a change in pull request #8232: Simplify DAG.set_dag_runs_state method
URL: https://github.com/apache/airflow/pull/8232#discussion_r406396004
 
 

 ##########
 File path: airflow/models/dag.py
 ##########
 @@ -912,12 +912,7 @@ def set_dag_runs_state(
             query = query.filter(DagRun.execution_date >= start_date)
         if end_date:
             query = query.filter(DagRun.execution_date <= end_date)
-        drs = query.all()
-
-        dirty_ids = []
-        for dr in drs:
-            dr.state = state
-            dirty_ids.append(dr.dag_id)
+        query.update({DagRun.state: state})
 
 Review comment:
   Yes, we are using this in many different places

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