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 2022/06/27 12:59:56 UTC
[GitHub] [airflow] TamGB opened a new issue, #24678: Macro prev_execution_date is empty
TamGB opened a new issue, #24678:
URL: https://github.com/apache/airflow/issues/24678
### Apache Airflow version
2.3.2 (latest released)
### What happened
The variable `prev_execution_date` is empty on the first run meaning, all usage will automatically trigger a None error.
### What you think should happen instead
A default date should be provided instead, either the DAG's `start_date` or a default `datetime.min` as during the first run, it will always trigger an error effectively preventing the DAG from running and hence, always returning an error.
### How to reproduce
Pass the variables/macros to any Task:
```
{
"execution_datetime": '{{ ts_nodash }}',
"prev_execution_datetime": '{{ prev_start_date_success | ts_nodash }}' #.strftime("%Y%m%dT%H%M%S")
}
```
Whilst the logical execution date (`execution_datetime`) works, the previous succesful logical execution date `prev_execution_datetime` automatically blows up when applying the `ts_nodash` filter. This effectively makes it impossible to use said macro ever, as it will always fail.
### Operating System
Ubuntu
### Versions of Apache Airflow Providers
_No response_
### Deployment
Official Apache Airflow Helm Chart
### Deployment details
_No response_
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] uranusjr commented on issue #24678: Macro prev_execution_date is always empty
Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #24678:
URL: https://github.com/apache/airflow/issues/24678#issuecomment-1167573954
Perhaps we should let `ts_nodash` et. al accept None (and just return None). It’ll make the template a bit easier to write.
--
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] TamGB commented on issue #24678: Macro prev_execution_date is always empty
Posted by GitBox <gi...@apache.org>.
TamGB commented on issue #24678:
URL: https://github.com/apache/airflow/issues/24678#issuecomment-1167495966
Overcame the problem using Jinja:
`{{ prev_start_date_success | ts_nodash if prev_start_date_success is not none else '19800101T000000' }}`
--
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] potiuk commented on issue #24678: Macro prev_execution_date is always empty
Posted by GitBox <gi...@apache.org>.
potiuk commented on issue #24678:
URL: https://github.com/apache/airflow/issues/24678#issuecomment-1167546715
You can also use the `default` built-in Ninja filter. This is much better than imposing some behaviour of the macro.
--
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] potiuk commented on issue #24678: Macro prev_execution_date is always empty
Posted by GitBox <gi...@apache.org>.
potiuk commented on issue #24678:
URL: https://github.com/apache/airflow/issues/24678#issuecomment-1168048791
Good idea @uranusjr :)
--
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] potiuk closed issue #24678: Macro prev_execution_date is always empty
Posted by GitBox <gi...@apache.org>.
potiuk closed issue #24678: Macro prev_execution_date is always empty
URL: https://github.com/apache/airflow/issues/24678
--
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 issue #24678: Macro prev_execution_date is always empty
Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #24678:
URL: https://github.com/apache/airflow/issues/24678#issuecomment-1168312177
Go ahead! The filters are in `airflow/templates.py`. I think we should add support for None in all of them.
--
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 closed issue #24678: Macro prev_execution_date is always empty
Posted by GitBox <gi...@apache.org>.
uranusjr closed issue #24678: Macro prev_execution_date is always empty
URL: https://github.com/apache/airflow/issues/24678
--
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] NaveenGokavarapu19 commented on issue #24678: Macro prev_execution_date is always empty
Posted by GitBox <gi...@apache.org>.
NaveenGokavarapu19 commented on issue #24678:
URL: https://github.com/apache/airflow/issues/24678#issuecomment-1168268345
Hii all,
I am interested in this issue. Can i contribute to this issue.
--
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] NaveenGokavarapu19 commented on issue #24678: Macro prev_execution_date is always empty
Posted by GitBox <gi...@apache.org>.
NaveenGokavarapu19 commented on issue #24678:
URL: https://github.com/apache/airflow/issues/24678#issuecomment-1168672008
is there way to assign it to me.
--
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] potiuk commented on issue #24678: Macro prev_execution_date is always empty
Posted by GitBox <gi...@apache.org>.
potiuk commented on issue #24678:
URL: https://github.com/apache/airflow/issues/24678#issuecomment-1168886836
assigned
--
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