reverse-engineer commented on issue #10112:
URL: https://github.com/apache/airflow/issues/10112#issuecomment-669113615


   Upon further investigation, this seems to be due to the fact that the 
`execution_date` is a `Pendulum` object, while other DAG dates in the code 
(`start_date`, `end_date`, etc.) are `datetime.datetime` objects. 
[Here](https://github.com/apache/airflow/blob/1.10.11/airflow/www/views.py#L1472),
 the execution date is parsed as a pendulum object.
   
   The bug occurs then because when selecting 'Future' to mark failed, 
`start_date` is 
[replaced](https://github.com/apache/airflow/blob/1.10.11/airflow/api/common/experimental/mark_tasks.py#L253)
 by `execution_date`, and later on, that `start_date`'s timezone (at that point 
it has become a pendulum TimezoneInfo object) is 
[used](https://github.com/apache/airflow/blob/1.10.11/airflow/utils/dates.py#L79)
 in `make_naive` for `end_date` 
[here](https://github.com/apache/airflow/blob/1.10.11/airflow/utils/dates.py#L89),
 which seems to cause the bug.
   
   Maybe when `start_date` is replaced by `execution_date`, it should be 
converted to a `datetime.datetime`?
   Replacing this:
   
   ```
       start_date = execution_date if not past else start_date
   ```
   with:
   
   ```
       start_date = datetime.datetime(execution_date.year,
                                      execution_date.month,
                                      execution_date.day,
                                      execution_date.hour,
                                      execution_date.minute,
                                      execution_date.second,
                                      execution_date.microsecond,
                                      tzinfo=execution_date.tz) if not past 
else start_date
   ```
   in 
https://github.com/apache/airflow/blob/1.10.11/airflow/api/common/experimental/mark_tasks.py#L253
 seems to work for me locally, but I didn't run all the tests etc. (I don't 
have a development environment), so I don't know if a airflow dev could have a 
look at this?
   


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to