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 2021/09/22 00:31:02 UTC

[GitHub] [airflow] uranusjr opened a new pull request #18420: Custom timetable must return aware datetimes

uranusjr opened a new pull request #18420:
URL: https://github.com/apache/airflow/pull/18420


   The example included in the recent AIP-39 documentation change had a bug that returns naive datetime for runs scheduled after a Friday.
   
   This also fixes a bug in `coerce_datetime` that may return a naive `pendulum.DateTime` in some edge cases.


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] uranusjr commented on a change in pull request #18420: Custom timetable must return aware datetimes

Posted by GitBox <gi...@apache.org>.
uranusjr commented on a change in pull request #18420:
URL: https://github.com/apache/airflow/pull/18420#discussion_r713508561



##########
File path: airflow/utils/timezone.py
##########
@@ -176,11 +176,11 @@ def parse(string: str, timezone=None) -> DateTime:
 
 
 def coerce_datetime(v: Union[None, dt.datetime, DateTime]) -> Optional[DateTime]:
-    """Convert whatever is passed in to ``pendulum.DateTime``."""
+    """Convert whatever is passed in to an timezone-aware ``pendulum.DateTime``."""
     if v is None:
         return None
-    if isinstance(v, DateTime):
-        return v
     if v.tzinfo is None:
         v = make_aware(v)
+    if isinstance(v, DateTime):
+        return v

Review comment:
       ``pendulum.DateTime`` can still be naive (as demostrated by this PR’s existence), so we must call `make_aware` to be sure.




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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb merged pull request #18420: Custom timetable must return aware datetimes

Posted by GitBox <gi...@apache.org>.
ashb merged pull request #18420:
URL: https://github.com/apache/airflow/pull/18420


   


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #18420: Custom timetable must return aware datetimes

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #18420:
URL: https://github.com/apache/airflow/pull/18420#issuecomment-925013056


   The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on pull request #18420: Custom timetable must return aware datetimes

Posted by GitBox <gi...@apache.org>.
ashb commented on pull request #18420:
URL: https://github.com/apache/airflow/pull/18420#issuecomment-925081043


   Failures unrelated to this PR and being fixed in another PR. Merging this now.


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org