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 01:07:37 UTC
[GitHub] [airflow] kaxil opened a new pull request #8225: Move
DAG._schedule_interval logic out of DAG.__init__
kaxil opened a new pull request #8225: Move DAG._schedule_interval logic out of DAG.__init__
URL: https://github.com/apache/airflow/pull/8225
closes https://github.com/apache/airflow/issues/8166
- Replace usage of `DAG._schedule_interval` with `DAG.normalized_schedule_interval`. This will even allow users to tests that they set correct Cron Preset in unit tests (instead of using an internal property before)
- Added tests for Schedule Interval & Normalized Schedule Interval
- Also solves the issue mentioned in https://github.com/apache/airflow/issues/8166
---
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] kaxil edited a comment on issue #8225: Move
DAG._schedule_interval logic out of DAG.__init__
Posted by GitBox <gi...@apache.org>.
kaxil edited a comment on issue #8225: Move DAG._schedule_interval logic out of DAG.__init__
URL: https://github.com/apache/airflow/pull/8225#issuecomment-612452255
Thanks for confirming @KostyaEsmukov
Yes this will be backported to v1-10 and would
be available in 1.10.11 :)
----------------------------------------------------------------
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] KostyaEsmukov commented on issue #8225: Move
DAG._schedule_interval logic out of DAG.__init__
Posted by GitBox <gi...@apache.org>.
KostyaEsmukov commented on issue #8225: Move DAG._schedule_interval logic out of DAG.__init__
URL: https://github.com/apache/airflow/pull/8225#issuecomment-612452509
Great, thank you!
----------------------------------------------------------------
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 merged pull request #8225: Move
DAG._schedule_interval logic out of DAG.__init__
Posted by GitBox <gi...@apache.org>.
kaxil merged pull request #8225: Move DAG._schedule_interval logic out of DAG.__init__
URL: https://github.com/apache/airflow/pull/8225
----------------------------------------------------------------
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] ashb commented on a change in pull request #8225: Move
DAG._schedule_interval logic out of DAG.__init__
Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #8225: Move DAG._schedule_interval logic out of DAG.__init__
URL: https://github.com/apache/airflow/pull/8225#discussion_r406103116
##########
File path: airflow/models/dag.py
##########
@@ -626,6 +620,24 @@ def is_paused(self) -> bool:
"""
return self._get_is_paused()
+ @property
Review comment:
Maybe, the downside to cached_property would be if dag.schedule_interval is changed, this parameter would be out of sync.
We could do it as:
```python
@property
def normalized_schedule_interval(self) -> Optional[ScheduleInterval]:
return self._normalized_schedule_interval(self.schedule_interval)
@functools.lru_cache(maxsize=1)
def _normalized_schedule_interval(self, schedule_interval) -> Optional[ScheduleInterval]:
...
```
Might be overkill.
----------------------------------------------------------------
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 edited a comment on issue #8225: Move
DAG._schedule_interval logic out of DAG.__init__
Posted by GitBox <gi...@apache.org>.
kaxil edited a comment on issue #8225: Move DAG._schedule_interval logic out of DAG.__init__
URL: https://github.com/apache/airflow/pull/8225#issuecomment-612452255
Thanks for confirming.
Yes this will be backported to v1-10 and would
be available in 1.10.11 :)
----------------------------------------------------------------
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] KostyaEsmukov commented on issue #8225: Move
DAG._schedule_interval logic out of DAG.__init__
Posted by GitBox <gi...@apache.org>.
KostyaEsmukov commented on issue #8225: Move DAG._schedule_interval logic out of DAG.__init__
URL: https://github.com/apache/airflow/pull/8225#issuecomment-612451967
@kaxil thank you for this fix! I have backported it to 1.10 and applied on my installation (instead of a patch in https://github.com/apache/airflow/issues/8166#issuecomment-610005896) and can confirm that it indeed fixes the issue.
Will this be backported to v1-10?
----------------------------------------------------------------
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 issue #8225: Move
DAG._schedule_interval logic out of DAG.__init__
Posted by GitBox <gi...@apache.org>.
kaxil commented on issue #8225: Move DAG._schedule_interval logic out of DAG.__init__
URL: https://github.com/apache/airflow/pull/8225#issuecomment-611272116
Please feel free to suggest a better name for the PR title/commit which looks good for the Changelog.
----------------------------------------------------------------
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 #8225: Move
DAG._schedule_interval logic out of DAG.__init__
Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #8225: Move DAG._schedule_interval logic out of DAG.__init__
URL: https://github.com/apache/airflow/pull/8225#discussion_r405903741
##########
File path: airflow/models/dag.py
##########
@@ -626,6 +620,24 @@ def is_paused(self) -> bool:
"""
return self._get_is_paused()
+ @property
Review comment:
Maybe @cached_property is better ?
----------------------------------------------------------------
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 issue #8225: Move
DAG._schedule_interval logic out of DAG.__init__
Posted by GitBox <gi...@apache.org>.
kaxil commented on issue #8225: Move DAG._schedule_interval logic out of DAG.__init__
URL: https://github.com/apache/airflow/pull/8225#issuecomment-612452255
Yes this will be backported to v1-10 and would be available in 1.10.11 :)
----------------------------------------------------------------
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 #8225: Move
DAG._schedule_interval logic out of DAG.__init__
Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #8225: Move DAG._schedule_interval logic out of DAG.__init__
URL: https://github.com/apache/airflow/pull/8225#issuecomment-611691257
# [Codecov](https://codecov.io/gh/apache/airflow/pull/8225?src=pr&el=h1) Report
> Merging [#8225](https://codecov.io/gh/apache/airflow/pull/8225?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/9468187c5a4abb4b060e6a61928a9673f98b556f&el=desc) will **decrease** coverage by `0.72%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/apache/airflow/pull/8225?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #8225 +/- ##
==========================================
- Coverage 88.31% 87.58% -0.73%
==========================================
Files 936 936
Lines 45272 45319 +47
==========================================
- Hits 39980 39694 -286
- Misses 5292 5625 +333
```
| [Impacted Files](https://codecov.io/gh/apache/airflow/pull/8225?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [airflow/models/dag.py](https://codecov.io/gh/apache/airflow/pull/8225/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvZGFnLnB5) | `91.68% <100.00%> (+0.03%)` | :arrow_up: |
| [airflow/models/dagbag.py](https://codecov.io/gh/apache/airflow/pull/8225/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvZGFnYmFnLnB5) | `89.83% <100.00%> (ø)` | |
| [...flow/providers/apache/cassandra/hooks/cassandra.py](https://codecov.io/gh/apache/airflow/pull/8225/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/8225/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/8225/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/8225/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/8225/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/8225/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/8225/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/8225/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3BvZF9sYXVuY2hlci5weQ==) | `47.18% <0.00%> (-45.08%)` | :arrow_down: |
| ... and [15 more](https://codecov.io/gh/apache/airflow/pull/8225/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/8225?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/8225?src=pr&el=footer). Last update [9468187...99e10a7](https://codecov.io/gh/apache/airflow/pull/8225?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