You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Jarek Potiuk (JIRA)" <ji...@apache.org> on 2019/07/28 18:59:00 UTC
[jira] [Resolved] (AIRFLOW-4788) prev_execution_date is not always
pendulum.datetime class
[ https://issues.apache.org/jira/browse/AIRFLOW-4788?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jarek Potiuk resolved AIRFLOW-4788.
-----------------------------------
Resolution: Fixed
Fix Version/s: 1.10.4
> prev_execution_date is not always pendulum.datetime class
> ---------------------------------------------------------
>
> Key: AIRFLOW-4788
> URL: https://issues.apache.org/jira/browse/AIRFLOW-4788
> Project: Apache Airflow
> Issue Type: Bug
> Components: core
> Affects Versions: 1.10.3
> Reporter: Daniel Standish
> Priority: Major
> Fix For: 1.10.4
>
>
> Despite documentation on macros page, previous execution dates are in general not pendulum type.
> For one, when reading from database, UtcDateTime returns native datetime type.
> Also dag.previous_schedule returns datetime type.
> So, in general, `prev_execution_date` and `ti.previous_ti.execution_date` may be non-pendulum.
> (there are edge cases when the context var prev_* is pendulum e.g. when there is no DR or no schedule interval or manually triggered, but in general, no.)
> The problem is, this leads to errors and confusion when using these fields in templating, when you expect it to be pendulum but it isn't.
> There are a few things to consider:
> # make UtcDateTime sqlalchemy type return pendulum
> # make execution date a property of TaskInstance with appropriate getter returning pendulum.
> # Change dag.previous_schedule to return pendulum
>
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)