You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jack (JIRA)" <ji...@apache.org> on 2019/07/14 05:49:00 UTC
[jira] [Commented] (AIRFLOW-4938) next_execution_date is not a
Pendulum object
[ https://issues.apache.org/jira/browse/AIRFLOW-4938?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16884571#comment-16884571 ]
jack commented on AIRFLOW-4938:
-------------------------------
Related/duplicate to/of :
https://issues.apache.org/jira/browse/AIRFLOW-4788
> next_execution_date is not a Pendulum object
> --------------------------------------------
>
> Key: AIRFLOW-4938
> URL: https://issues.apache.org/jira/browse/AIRFLOW-4938
> Project: Apache Airflow
> Issue Type: Bug
> Components: models
> Affects Versions: 1.10.2
> Environment: Airlfow 1.10.2 in Docker using puckel docker image.
> Configured for timezone Copenhagen
> Reporter: Adam Andersen Læssøe
> Priority: Major
>
> When templating, it seems `execution_date` refers to a Pendulum object while `next_execution_date` refers to a native `datetime` object.
> This is inconsistent, and contrary to what the docs say, so I'm thinking it's a bug.
> *Observation*
> Airflow is configured to run in timezone Copenhagen.
> I have a where clause like
> ```
> {code:java}
> WHERE inserted_at >= '{{execution_date}}' AND inserted_at < '{{next_execution_date}}'{code}
> I execute the task using `airflow test ... 2019-07-01`.
> The clause is rendered as
> {code:java}
> WHERE inserted_at >= '2019-07-01T00:00:00+02:00' AND inserted_at < '2019-07-01 22:00:00+00:00'{code}
>
> Note how `execution_date` is printed as UTC+2, while `next_execution_date` is printed in UTC. I believe the timestamps actually decribe the correct interval, but to be certain I tried explicitly converting to UTC:
> {code:java}
> WHERE inserted_at >= '{{execution_date.in_tz('UTC')}}' AND inserted_at < '{{next_execution_date.in_tz('UTC')}}'{code}
> I then get an error that datetime.datetime does not have an in_tz method.
>
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)