-
Notifications
You must be signed in to change notification settings - Fork 16.4k
fix: force DAG last modified time to UTC #30243
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
potiuk
left a comment
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.
|
Makes sense, except calling |
5cae2f0 to
91d4142
Compare
|
thanks for the feedback! I've updated the PR to use |
|
Is it possible to have a test for this? |
91d4142 to
b06e7a5
Compare
|
I've updated the existing test to trigger the issue by forcing the platform timezone to something different than UTC. Running the test reverting the fix fails (as expected) with this error: Let me know if there's a better way to test that. |
b06e7a5 to
9f303c9
Compare
9f303c9 to
4c2f5a5
Compare
4c2f5a5 to
381f8ea
Compare
|
Awesome work, congrats on your first merged pull request! |
Co-authored-by: Sébastien Brochet <sebastien.brochet@nielsen.com> (cherry picked from commit 7a8b3c4)
This fixture was, in theory, able to reproduce the bug fixed in apache#30243, but I was unable to now. So, let's toss it.
This fixture was, in theory, able to reproduce the bug fixed in apache#30243, but I was unable to now. So, let's toss it.
This fixture was, in theory, able to reproduce the bug fixed in #30243, but I was unable to now. So, let's toss it.
This fixture was, in theory, able to reproduce the bug fixed in apache#30243, but I was unable to now. So, let's toss it.
This fixture was, in theory, able to reproduce the bug fixed in apache#30243, but I was unable to now. So, let's toss it.
Hello,
I've found an issue with the handling of the DAG file last modified time which can trigger an infinite parsing loop, when
file_parsing_sort_modeis set tomodified_time(which seems to be the default value).os.path.getmtime()returns a timestamp, which is converted to a datetime usingdatetime.fromtimestamp. According to the documentation:The resulting datetime is then made aware using
timezone.make_awareusing the user configured timezone, which is not guarantee to be the same as the platform's timezone. If that's not the case, we can end up with modified time in the future and trigger an infinite parsing loop.The fix is to use
datetime.utcfromtimestampto convert the timestamp, to force the resulting datetime in UTC, and explicitly specify the UTC timezone tomake_aware.^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.