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

 ##########
 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:
   > > Can you just double-check & confirm that tests for this function are 
already covered?
   > 
   > @kaxil I've added a test for this method
   
   Awesome, feel free to merge once the test passes

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