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 13:16:58 UTC

[GitHub] [airflow] turbaszek opened a new pull request #8232: Simplify DAG.set_dag_runs_state method

turbaszek opened a new pull request #8232: Simplify DAG.set_dag_runs_state method
URL: https://github.com/apache/airflow/pull/8232
 
 
   ---
   Make sure to mark the boxes below before creating PR: [x]
   
   - [x] Description above provides context of the change
   - [x] Unit tests coverage for changes (not needed for documentation changes)
   - [x] Commits follow "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)"
   - [x] Relevant documentation is updated including usage instructions.
   - [x] I will engage committers as explained in [Contribution Workflow Example](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#contribution-workflow-example).
   
   ---
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   Read the [Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines) for more information.
   

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

[GitHub] [airflow] codecov-io commented on issue #8232: Simplify DAG.set_dag_runs_state method

Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #8232: Simplify DAG.set_dag_runs_state method
URL: https://github.com/apache/airflow/pull/8232#issuecomment-611742609
 
 
   # [Codecov](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=h1) Report
   > Merging [#8232](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/ad42c4076479fe7420dc329ee8bfd51d9fb0a2ae&el=desc) will **decrease** coverage by `0.77%`.
   > The diff coverage is `100.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/8232/graphs/tree.svg?width=650&height=150&src=pr&token=WdLKlKHOAU)](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #8232      +/-   ##
   ==========================================
   - Coverage   88.35%   87.58%   -0.78%     
   ==========================================
     Files         936      936              
     Lines       45305    45312       +7     
   ==========================================
   - Hits        40030    39687     -343     
   - Misses       5275     5625     +350     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [airflow/models/dag.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvZGFnLnB5) | `91.61% <100.00%> (-0.05%)` | :arrow_down: |
   | [...flow/providers/apache/cassandra/hooks/cassandra.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2Nhc3NhbmRyYS9ob29rcy9jYXNzYW5kcmEucHk=) | `21.25% <0.00%> (-72.50%)` | :arrow_down: |
   | [...w/providers/apache/hive/operators/mysql\_to\_hive.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2hpdmUvb3BlcmF0b3JzL215c3FsX3RvX2hpdmUucHk=) | `35.84% <0.00%> (-64.16%)` | :arrow_down: |
   | [airflow/kubernetes/volume\_mount.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZV9tb3VudC5weQ==) | `44.44% <0.00%> (-55.56%)` | :arrow_down: |
   | [airflow/providers/postgres/operators/postgres.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcG9zdGdyZXMvb3BlcmF0b3JzL3Bvc3RncmVzLnB5) | `47.82% <0.00%> (-52.18%)` | :arrow_down: |
   | [airflow/providers/redis/operators/redis\_publish.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcmVkaXMvb3BlcmF0b3JzL3JlZGlzX3B1Ymxpc2gucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [airflow/kubernetes/volume.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZS5weQ==) | `52.94% <0.00%> (-47.06%)` | :arrow_down: |
   | [airflow/providers/mongo/sensors/mongo.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbW9uZ28vc2Vuc29ycy9tb25nby5weQ==) | `53.33% <0.00%> (-46.67%)` | :arrow_down: |
   | [airflow/kubernetes/pod\_launcher.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3BvZF9sYXVuY2hlci5weQ==) | `47.18% <0.00%> (-45.08%)` | :arrow_down: |
   | [airflow/providers/mysql/operators/mysql.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbXlzcWwvb3BlcmF0b3JzL215c3FsLnB5) | `55.00% <0.00%> (-45.00%)` | :arrow_down: |
   | ... and [12 more](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=footer). Last update [ad42c40...31cd70c](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

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

[GitHub] [airflow] codecov-io edited a comment on issue #8232: Simplify DAG.set_dag_runs_state method

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #8232: Simplify DAG.set_dag_runs_state method
URL: https://github.com/apache/airflow/pull/8232#issuecomment-611742609
 
 
   # [Codecov](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=h1) Report
   > Merging [#8232](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/c983e468d43c7ae446f23452e744a321c24d1707&el=desc) will **increase** coverage by `21.76%`.
   > The diff coverage is `100.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/8232/graphs/tree.svg?width=650&height=150&src=pr&token=WdLKlKHOAU)](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           master    #8232       +/-   ##
   ===========================================
   + Coverage   66.31%   88.07%   +21.76%     
   ===========================================
     Files         936      936               
     Lines       45317    45313        -4     
   ===========================================
   + Hits        30051    39909     +9858     
   + Misses      15266     5404     -9862     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [airflow/models/dag.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvZGFnLnB5) | `91.64% <100.00%> (+33.20%)` | :arrow_up: |
   | [airflow/kubernetes/volume\_mount.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZV9tb3VudC5weQ==) | `44.44% <0.00%> (-55.56%)` | :arrow_down: |
   | [airflow/kubernetes/volume.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZS5weQ==) | `52.94% <0.00%> (-47.06%)` | :arrow_down: |
   | [airflow/kubernetes/pod\_launcher.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3BvZF9sYXVuY2hlci5weQ==) | `47.18% <0.00%> (-39.44%)` | :arrow_down: |
   | [...viders/cncf/kubernetes/operators/kubernetes\_pod.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvY25jZi9rdWJlcm5ldGVzL29wZXJhdG9ycy9rdWJlcm5ldGVzX3BvZC5weQ==) | `69.69% <0.00%> (-25.26%)` | :arrow_down: |
   | [airflow/kubernetes/refresh\_config.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3JlZnJlc2hfY29uZmlnLnB5) | `50.98% <0.00%> (-23.53%)` | :arrow_down: |
   | [airflow/providers/google/cloud/operators/vision.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2Nsb3VkL29wZXJhdG9ycy92aXNpb24ucHk=) | `99.63% <0.00%> (+0.36%)` | :arrow_up: |
   | [...osoft/azure/operators/azure\_container\_instances.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbWljcm9zb2Z0L2F6dXJlL29wZXJhdG9ycy9henVyZV9jb250YWluZXJfaW5zdGFuY2VzLnB5) | `78.28% <0.00%> (+0.65%)` | :arrow_up: |
   | [airflow/cli/cli\_parser.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9jbGkvY2xpX3BhcnNlci5weQ==) | `97.28% <0.00%> (+0.90%)` | :arrow_up: |
   | [airflow/providers/postgres/hooks/postgres.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcG9zdGdyZXMvaG9va3MvcG9zdGdyZXMucHk=) | `94.36% <0.00%> (+1.40%)` | :arrow_up: |
   | ... and [499 more](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=footer). Last update [c983e46...140b71e](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

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

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

Posted by GitBox <gi...@apache.org>.
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_r406396586
 
 

 ##########
 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)
 
 Review comment:
   That was my main reason to do this change...

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

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

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] turbaszek merged pull request #8232: Simplify DAG.set_dag_runs_state method

Posted by GitBox <gi...@apache.org>.
turbaszek merged pull request #8232: Simplify DAG.set_dag_runs_state method
URL: https://github.com/apache/airflow/pull/8232
 
 
   

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

[GitHub] [airflow] codecov-io edited a comment on issue #8232: Simplify DAG.set_dag_runs_state method

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #8232: Simplify DAG.set_dag_runs_state method
URL: https://github.com/apache/airflow/pull/8232#issuecomment-611742609
 
 
   # [Codecov](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=h1) Report
   > Merging [#8232](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/c983e468d43c7ae446f23452e744a321c24d1707&el=desc) will **increase** coverage by `21.76%`.
   > The diff coverage is `100.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/8232/graphs/tree.svg?width=650&height=150&src=pr&token=WdLKlKHOAU)](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           master    #8232       +/-   ##
   ===========================================
   + Coverage   66.31%   88.07%   +21.76%     
   ===========================================
     Files         936      936               
     Lines       45317    45313        -4     
   ===========================================
   + Hits        30051    39909     +9858     
   + Misses      15266     5404     -9862     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [airflow/models/dag.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvZGFnLnB5) | `91.64% <100.00%> (+33.20%)` | :arrow_up: |
   | [airflow/kubernetes/volume\_mount.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZV9tb3VudC5weQ==) | `44.44% <0.00%> (-55.56%)` | :arrow_down: |
   | [airflow/kubernetes/volume.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZS5weQ==) | `52.94% <0.00%> (-47.06%)` | :arrow_down: |
   | [airflow/kubernetes/pod\_launcher.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3BvZF9sYXVuY2hlci5weQ==) | `47.18% <0.00%> (-39.44%)` | :arrow_down: |
   | [...viders/cncf/kubernetes/operators/kubernetes\_pod.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvY25jZi9rdWJlcm5ldGVzL29wZXJhdG9ycy9rdWJlcm5ldGVzX3BvZC5weQ==) | `69.69% <0.00%> (-25.26%)` | :arrow_down: |
   | [airflow/kubernetes/refresh\_config.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3JlZnJlc2hfY29uZmlnLnB5) | `50.98% <0.00%> (-23.53%)` | :arrow_down: |
   | [airflow/providers/google/cloud/operators/vision.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2Nsb3VkL29wZXJhdG9ycy92aXNpb24ucHk=) | `99.63% <0.00%> (+0.36%)` | :arrow_up: |
   | [...osoft/azure/operators/azure\_container\_instances.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbWljcm9zb2Z0L2F6dXJlL29wZXJhdG9ycy9henVyZV9jb250YWluZXJfaW5zdGFuY2VzLnB5) | `78.28% <0.00%> (+0.65%)` | :arrow_up: |
   | [airflow/cli/cli\_parser.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9jbGkvY2xpX3BhcnNlci5weQ==) | `97.28% <0.00%> (+0.90%)` | :arrow_up: |
   | [airflow/providers/postgres/hooks/postgres.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcG9zdGdyZXMvaG9va3MvcG9zdGdyZXMucHk=) | `94.36% <0.00%> (+1.40%)` | :arrow_up: |
   | ... and [499 more](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=footer). Last update [c983e46...140b71e](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

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

[GitHub] [airflow] turbaszek commented on issue #8232: Simplify DAG.set_dag_runs_state method

Posted by GitBox <gi...@apache.org>.
turbaszek commented on issue #8232: Simplify DAG.set_dag_runs_state method
URL: https://github.com/apache/airflow/pull/8232#issuecomment-611683855
 
 
   > Can you just double-check & confirm that tests for this function are already covered?
   
   @kaxil I've added a test for this method

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

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

Posted by GitBox <gi...@apache.org>.
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_r406369525
 
 

 ##########
 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:
   I guess yes based on https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query.update

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

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

Posted by GitBox <gi...@apache.org>.
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_r406369137
 
 

 ##########
 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:
   Will this work if multiple DagRuns are returned?

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

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

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #8232: Simplify DAG.set_dag_runs_state method
URL: https://github.com/apache/airflow/pull/8232#discussion_r406358379
 
 

 ##########
 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)
 
 Review comment:
   I wonder why we needed that dirty_ids list. Does not see to be used :).

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

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

Posted by GitBox <gi...@apache.org>.
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

[GitHub] [airflow] codecov-io edited a comment on issue #8232: Simplify DAG.set_dag_runs_state method

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #8232: Simplify DAG.set_dag_runs_state method
URL: https://github.com/apache/airflow/pull/8232#issuecomment-611742609
 
 
   # [Codecov](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=h1) Report
   > Merging [#8232](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/ad42c4076479fe7420dc329ee8bfd51d9fb0a2ae&el=desc) will **decrease** coverage by `0.77%`.
   > The diff coverage is `100.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/8232/graphs/tree.svg?width=650&height=150&src=pr&token=WdLKlKHOAU)](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #8232      +/-   ##
   ==========================================
   - Coverage   88.35%   87.58%   -0.78%     
   ==========================================
     Files         936      936              
     Lines       45305    45312       +7     
   ==========================================
   - Hits        40030    39687     -343     
   - Misses       5275     5625     +350     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [airflow/models/dag.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvZGFnLnB5) | `91.61% <100.00%> (-0.05%)` | :arrow_down: |
   | [...flow/providers/apache/cassandra/hooks/cassandra.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2Nhc3NhbmRyYS9ob29rcy9jYXNzYW5kcmEucHk=) | `21.25% <0.00%> (-72.50%)` | :arrow_down: |
   | [...w/providers/apache/hive/operators/mysql\_to\_hive.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2hpdmUvb3BlcmF0b3JzL215c3FsX3RvX2hpdmUucHk=) | `35.84% <0.00%> (-64.16%)` | :arrow_down: |
   | [airflow/kubernetes/volume\_mount.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZV9tb3VudC5weQ==) | `44.44% <0.00%> (-55.56%)` | :arrow_down: |
   | [airflow/providers/postgres/operators/postgres.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcG9zdGdyZXMvb3BlcmF0b3JzL3Bvc3RncmVzLnB5) | `47.82% <0.00%> (-52.18%)` | :arrow_down: |
   | [airflow/providers/redis/operators/redis\_publish.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcmVkaXMvb3BlcmF0b3JzL3JlZGlzX3B1Ymxpc2gucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [airflow/kubernetes/volume.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZS5weQ==) | `52.94% <0.00%> (-47.06%)` | :arrow_down: |
   | [airflow/providers/mongo/sensors/mongo.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbW9uZ28vc2Vuc29ycy9tb25nby5weQ==) | `53.33% <0.00%> (-46.67%)` | :arrow_down: |
   | [airflow/kubernetes/pod\_launcher.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3BvZF9sYXVuY2hlci5weQ==) | `47.18% <0.00%> (-45.08%)` | :arrow_down: |
   | [airflow/providers/mysql/operators/mysql.py](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbXlzcWwvb3BlcmF0b3JzL215c3FsLnB5) | `55.00% <0.00%> (-45.00%)` | :arrow_down: |
   | ... and [12 more](https://codecov.io/gh/apache/airflow/pull/8232/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=footer). Last update [ad42c40...31cd70c](https://codecov.io/gh/apache/airflow/pull/8232?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

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

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

Posted by GitBox <gi...@apache.org>.
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_r406400299
 
 

 ##########
 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)
 
 Review comment:
   Yeah that is strange

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