You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Daniel Standish (JIRA)" <ji...@apache.org> on 2019/06/12 19:19:00 UTC

[jira] [Created] (AIRFLOW-4788) prev_execution_date is not always pendulum.datetime class

Daniel Standish created AIRFLOW-4788:
----------------------------------------

             Summary: 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


In certain circumstances previous execution dates may not be pendulum type.

For one, when reading from database, UtcDateTime returns native datetime type.

Also dag.previous_schedule returns datetime type.

So, depending on circumstances, `prev_execution_date` and `ti.previous_ti.execution_date` may be non-pendulum. 

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.3#76005)