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/02/20 03:46:41 UTC
[GitHub] [airflow] yuqian90 opened a new pull request #7470: [AIRFLOW-6834]
Fix flaky test_scheduler_job by sorting TaskInstance
yuqian90 opened a new pull request #7470: [AIRFLOW-6834] Fix flaky test_scheduler_job by sorting TaskInstance
URL: https://github.com/apache/airflow/pull/7470
Fix a flaky test that fails because `TaskInstance` are returned in non-deterministic order:
```
test_scheduler_job.py::TestDagFileProcessor::test_dag_file_processor_process_task_instances_depends_on_past
```
---
Issue link: WILL BE INSERTED BY [boring-cyborg](https://github.com/kaxil/boring-cyborg)
Make sure to mark the boxes below before creating PR: [x]
- [x] Description above provides context of the change
- [x] Commit message/PR title starts with `[AIRFLOW-NNNN]`. AIRFLOW-NNNN = JIRA ID<sup>*</sup>
- [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).
<sup>*</sup> For document-only changes commit message can start with `[AIRFLOW-XXXX]`.
---
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] yuqian90 commented on a change in pull request #7470:
[AIRFLOW-6834] Fix flaky test_scheduler_job by sorting TaskInstance
Posted by GitBox <gi...@apache.org>.
yuqian90 commented on a change in pull request #7470: [AIRFLOW-6834] Fix flaky test_scheduler_job by sorting TaskInstance
URL: https://github.com/apache/airflow/pull/7470#discussion_r382962334
##########
File path: airflow/models/dagrun.py
##########
@@ -201,7 +201,7 @@ def get_task_instances(self, state=None, session=None):
if self.dag and self.dag.partial:
tis = tis.filter(TaskInstance.task_id.in_(self.dag.task_ids))
- return tis.all()
+ return tis.order_by(TaskInstance.execution_date, TaskInstance.dag_id, TaskInstance.task_id).all()
Review comment:
Good point. That's done. I changed the test instead.
----------------------------------------------------------------
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 #7470: [AIRFLOW-6834] Fix
flaky test_scheduler_job by sorting TaskInstance
Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #7470: [AIRFLOW-6834] Fix flaky test_scheduler_job by sorting TaskInstance
URL: https://github.com/apache/airflow/pull/7470#issuecomment-588602591
# [Codecov](https://codecov.io/gh/apache/airflow/pull/7470?src=pr&el=h1) Report
> Merging [#7470](https://codecov.io/gh/apache/airflow/pull/7470?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/1a9a9f7618f1c22e3e9a6ef4ec73b717c7760c7d?src=pr&el=desc) will **decrease** coverage by `0.45%`.
> The diff coverage is `100%`.
[](https://codecov.io/gh/apache/airflow/pull/7470?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #7470 +/- ##
==========================================
- Coverage 86.68% 86.22% -0.46%
==========================================
Files 882 882
Lines 41526 41526
==========================================
- Hits 35997 35806 -191
- Misses 5529 5720 +191
```
| [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7470?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [airflow/models/dagrun.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvZGFncnVuLnB5) | `96.55% <100%> (ø)` | :arrow_up: |
| [...w/providers/apache/hive/operators/mysql\_to\_hive.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2hpdmUvb3BlcmF0b3JzL215c3FsX3RvX2hpdmUucHk=) | `35.84% <0%> (-64.16%)` | :arrow_down: |
| [airflow/kubernetes/volume\_mount.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZV9tb3VudC5weQ==) | `44.44% <0%> (-55.56%)` | :arrow_down: |
| [airflow/kubernetes/volume.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZS5weQ==) | `52.94% <0%> (-47.06%)` | :arrow_down: |
| [airflow/security/kerberos.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9zZWN1cml0eS9rZXJiZXJvcy5weQ==) | `30.43% <0%> (-45.66%)` | :arrow_down: |
| [airflow/kubernetes/pod\_launcher.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3BvZF9sYXVuY2hlci5weQ==) | `47.18% <0%> (-45.08%)` | :arrow_down: |
| [airflow/providers/mysql/operators/mysql.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbXlzcWwvb3BlcmF0b3JzL215c3FsLnB5) | `55% <0%> (-45%)` | :arrow_down: |
| [...viders/cncf/kubernetes/operators/kubernetes\_pod.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvY25jZi9rdWJlcm5ldGVzL29wZXJhdG9ycy9rdWJlcm5ldGVzX3BvZC5weQ==) | `69.38% <0%> (-25.52%)` | :arrow_down: |
| [airflow/kubernetes/refresh\_config.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3JlZnJlc2hfY29uZmlnLnB5) | `50.98% <0%> (-23.53%)` | :arrow_down: |
| [airflow/providers/apache/hive/hooks/hive.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2hpdmUvaG9va3MvaGl2ZS5weQ==) | `76.02% <0%> (-1.54%)` | :arrow_down: |
| ... and [2 more](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7470?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/7470?src=pr&el=footer). Last update [1a9a9f7...13e180b](https://codecov.io/gh/apache/airflow/pull/7470?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] yuqian90 commented on a change in pull request #7470:
[AIRFLOW-6834] Fix some flaky tests in test_scheduler_job.py
Posted by GitBox <gi...@apache.org>.
yuqian90 commented on a change in pull request #7470: [AIRFLOW-6834] Fix some flaky tests in test_scheduler_job.py
URL: https://github.com/apache/airflow/pull/7470#discussion_r382974156
##########
File path: airflow/cli/commands/task_command.py
##########
@@ -158,33 +158,32 @@ def task_run(args, dag=None):
# behind multiple open sleeping connections while heartbeating, which could
# easily exceed the database connection limit when
# processing hundreds of simultaneous tasks.
- settings.configure_orm(disable_connection_pool=True)
Review comment:
This change is needed because I realized test_task_commands sometimes interferes with other tests because this line sets `disable_connection_pool` to True without setting it back. So when test_task_commands run first, connection pool is disabled globally and never restored.
----------------------------------------------------------------
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 #7470:
[AIRFLOW-6834] Fix flaky test_scheduler_job by sorting TaskInstance
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #7470: [AIRFLOW-6834] Fix flaky test_scheduler_job by sorting TaskInstance
URL: https://github.com/apache/airflow/pull/7470#issuecomment-588602591
# [Codecov](https://codecov.io/gh/apache/airflow/pull/7470?src=pr&el=h1) Report
> Merging [#7470](https://codecov.io/gh/apache/airflow/pull/7470?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/61a8bb65818521ccbb846e647103535b3e36b26d?src=pr&el=desc) will **decrease** coverage by `0.46%`.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/apache/airflow/pull/7470?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #7470 +/- ##
==========================================
- Coverage 86.82% 86.36% -0.47%
==========================================
Files 891 891
Lines 42095 42095
==========================================
- Hits 36549 36354 -195
- Misses 5546 5741 +195
```
| [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7470?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...w/providers/apache/hive/operators/mysql\_to\_hive.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2hpdmUvb3BlcmF0b3JzL215c3FsX3RvX2hpdmUucHk=) | `35.84% <0%> (-64.16%)` | :arrow_down: |
| [airflow/kubernetes/volume\_mount.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZV9tb3VudC5weQ==) | `44.44% <0%> (-55.56%)` | :arrow_down: |
| [airflow/kubernetes/volume.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZS5weQ==) | `52.94% <0%> (-47.06%)` | :arrow_down: |
| [airflow/security/kerberos.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9zZWN1cml0eS9rZXJiZXJvcy5weQ==) | `30.43% <0%> (-45.66%)` | :arrow_down: |
| [airflow/kubernetes/pod\_launcher.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3BvZF9sYXVuY2hlci5weQ==) | `47.18% <0%> (-45.08%)` | :arrow_down: |
| [airflow/providers/mysql/operators/mysql.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbXlzcWwvb3BlcmF0b3JzL215c3FsLnB5) | `55% <0%> (-45%)` | :arrow_down: |
| [...viders/cncf/kubernetes/operators/kubernetes\_pod.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvY25jZi9rdWJlcm5ldGVzL29wZXJhdG9ycy9rdWJlcm5ldGVzX3BvZC5weQ==) | `69.38% <0%> (-25.52%)` | :arrow_down: |
| [airflow/kubernetes/refresh\_config.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3JlZnJlc2hfY29uZmlnLnB5) | `50.98% <0%> (-23.53%)` | :arrow_down: |
| [airflow/providers/apache/hive/hooks/hive.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2hpdmUvaG9va3MvaGl2ZS5weQ==) | `76.02% <0%> (-1.54%)` | :arrow_down: |
| [airflow/jobs/backfill\_job.py](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree#diff-YWlyZmxvdy9qb2JzL2JhY2tmaWxsX2pvYi5weQ==) | `90.98% <0%> (-1.13%)` | :arrow_down: |
| ... and [2 more](https://codecov.io/gh/apache/airflow/pull/7470/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7470?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/7470?src=pr&el=footer). Last update [61a8bb6...702523b](https://codecov.io/gh/apache/airflow/pull/7470?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 #7470:
[AIRFLOW-6834] Fix flaky test_scheduler_job by sorting TaskInstance
Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #7470: [AIRFLOW-6834] Fix flaky test_scheduler_job by sorting TaskInstance
URL: https://github.com/apache/airflow/pull/7470#discussion_r382751294
##########
File path: airflow/models/dagrun.py
##########
@@ -201,7 +201,7 @@ def get_task_instances(self, state=None, session=None):
if self.dag and self.dag.partial:
tis = tis.filter(TaskInstance.task_id.in_(self.dag.task_ids))
- return tis.all()
+ return tis.order_by(TaskInstance.execution_date, TaskInstance.dag_id, TaskInstance.task_id).all()
Review comment:
How about changing the test itself so order doesn't matter?
----------------------------------------------------------------
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] stale[bot] closed pull request #7470: [AIRFLOW-6834] Fix
some flaky tests in test_scheduler_job.py
Posted by GitBox <gi...@apache.org>.
stale[bot] closed pull request #7470: [AIRFLOW-6834] Fix some flaky tests in test_scheduler_job.py
URL: https://github.com/apache/airflow/pull/7470
----------------------------------------------------------------
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] stale[bot] commented on issue #7470: [AIRFLOW-6834] Fix
some flaky tests in test_scheduler_job.py
Posted by GitBox <gi...@apache.org>.
stale[bot] commented on issue #7470: [AIRFLOW-6834] Fix some flaky tests in test_scheduler_job.py
URL: https://github.com/apache/airflow/pull/7470#issuecomment-611060856
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
----------------------------------------------------------------
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