-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Replaced all days_ago functions with datetime functions #21796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
|
| from datetime import timedelta | ||
|
|
||
| import datetime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If from datetime import timedelta already present why not doing
from datetime import datetime, timedelta
and use datetime(2022,1,1) rather than datetime.datetime(2022,1,1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh! didn't see that there. There are a lot of files and I checked each one manually for maximum efficiency so forgot to use some of the already present libraries. If you want I can change them again quickly
| dag_id="TEST_DAG_ID", | ||
| default_args=dict( | ||
| start_date=days_ago(2), | ||
| start_date=datetime.datetime(2022, 1, 1), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean just for tests or also for example dags?
I have no objection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For unit tests as well as example DAGs for consistency in tests, examples, docs, etc. The core example DAGs have been transitioned but the provider ones haven't yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I too think pendulum is a better alternative for datetime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then yeah lets do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course! Not a problem at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another pull request after swapping datetime with pendulum where start dates are involved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For tests specifically I actually prefer datetime.datetime since it better ensures we are coercing timezones correctly internally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That one is also done in the previous pull request. I guess my task is done so please let me know if there is anything more to update.
`days_ago` is going to be deprecated and removed. Vote: https://lists.apache.org/thread/qfqjb8m3v834yc8mxo1oqtjddhp9sggk PR: apache/airflow#21796 Issue: apache/airflow#21683
|
Please fix the static check failures. |
`days_ago` is going to be deprecated and removed. Vote: https://lists.apache.org/thread/qfqjb8m3v834yc8mxo1oqtjddhp9sggk PR: apache/airflow#21796 Issue: apache/airflow#21683
|
Sure, Thanks
…On Tue, Mar 1, 2022, 7:03 AM Tzu-ping Chung ***@***.***> wrote:
Please fix the static check failures.
—
Reply to this email directly, view it on GitHub
<#21796 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXEWNKDPYBCSGSCMKS544FTU5VXXTANCNFSM5PH3L2JA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
I tried solving the static checks but wasn't able to do so. Can you help me on what is wrong exactly |
|
@Dev232001 run Alternatively you can run static check via Breeze too. Under the hood this runs pre-commit too. |
|
@Dev232001 do you need further help? |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
|
Superceded by #23237. |
`days_ago` is going to be deprecated and removed. Vote: https://lists.apache.org/thread/qfqjb8m3v834yc8mxo1oqtjddhp9sggk PR: apache/airflow#21796 Issue: apache/airflow#21683
closes: #21683
Replace all the days_ago functions with datetime functions as asked in the issue