apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
37.12k stars 14.31k forks source link

Airflow 2.9.1 : AirflowContextDeprecationWarning: Accessing 'yesterday_ds_nodash' from the template is deprecated and will be removed in a future version. #42806

Open shahar1 opened 1 month ago

shahar1 commented 1 month ago

Discussed in https://github.com/apache/airflow/discussions/40113

Originally posted by **michaelritsema** June 6, 2024 ### Apache Airflow version 2.9.1 ### If "Other Airflow 2 version" selected, which one? _No response_ ### What happened? related: #20603 I installed from PIP and in development mode on a mac. I'm experiencing this same issue when calling get_context() I'm new to airflow but it seems like there are still references to this in the code: class _BasePythonVirtualenvOperator(PythonOperator, metaclass=ABCMeta): BASE_SERIALIZABLE_CONTEXT_KEYS = { "ds", "ds_nodash", "expanded_ti_count", "inlets", "map_index_template", "next_ds", "next_ds_nodash", "outlets", "prev_ds", "prev_ds_nodash", "run_id", "task_instance_key_str", "test_mode", "tomorrow_ds", "tomorrow_ds_nodash", "ts", "ts_nodash", "ts_nodash_with_tz", "yesterday_ds", "yesterday_ds_nodash", } expanded log: /Users/mr/airflow/lib/python3.11/site-packages/airflow/utils/context.py:212 AirflowContextDeprecationWarning: Accessing 'execution_date' from the template is deprecated and will be removed in a future version. Please use 'data_interval_start' or 'logical_date' instead. /Users/mr/airflow/lib/python3.11/site-packages/airflow/utils/context.py:212 AirflowContextDeprecationWarning: Accessing 'next_ds' from the template is deprecated and will be removed in a future version. Please use '{{ data_interval_end | ds }}' instead. /Users/mr/airflow/lib/python3.11/site-packages/airflow/utils/context.py:212 AirflowContextDeprecationWarning: Accessing 'next_ds_nodash' from the template is deprecated and will be removed in a future version. Please use '{{ data_interval_end | ds_nodash }}' instead. /Users/mr/airflow/lib/python3.11/site-packages/airflow/utils/context.py:212 AirflowContextDeprecationWarning: Accessing 'next_execution_date' from the template is deprecated and will be removed in a future version. Please use 'data_interval_end' instead. /Users/mr/airflow/lib/python3.11/site-packages/airflow/utils/context.py:212 AirflowContextDeprecationWarning: Accessing 'prev_ds' from the template is deprecated and will be removed in a future version. /Users/mr/airflow/lib/python3.11/site-packages/airflow/utils/context.py:212 AirflowContextDeprecationWarning: Accessing 'prev_ds_nodash' from the template is deprecated and will be removed in a future version. /Users/mr/airflow/lib/python3.11/site-packages/airflow/utils/context.py:212 AirflowContextDeprecationWarning: Accessing 'prev_execution_date' from the template is deprecated and will be removed in a future version. /Users/mr/airflow/lib/python3.11/site-packages/airflow/utils/context.py:212 AirflowContextDeprecationWarning: Accessing 'prev_execution_date_success' from the template is deprecated and will be removed in a future version. Please use 'prev_data_interval_start_success' instead. /Users/mr/airflow/lib/python3.11/site-packages/airflow/utils/context.py:212 AirflowContextDeprecationWarning: Accessing 'tomorrow_ds' from the template is deprecated and will be removed in a future version. /Users/mr/airflow/lib/python3.11/site-packages/airflow/utils/context.py:212 AirflowContextDeprecationWarning: Accessing 'tomorrow_ds_nodash' from the template is deprecated and will be removed in a future version. /Users/mr/airflow/lib/python3.11/site-packages/airflow/utils/context.py:212 AirflowContextDeprecationWarning: Accessing 'yesterday_ds' from the template is deprecated and will be removed in a future version. /Users/mr/airflow/lib/python3.11/site-packages/airflow/utils/context.py:212 AirflowContextDeprecationWarning: Accessing 'yesterday_ds_nodash' from the template is deprecated and will be removed in a future version. ### What you think should happen instead? _No response_ ### How to reproduce any call to get_context() ### Operating System Sonoma 14.5 ### Versions of Apache Airflow Providers airflow-clickhouse-plugin==1.3.0 apache-airflow==2.9.1 apache-airflow-providers-common-io==1.3.2 apache-airflow-providers-common-sql==1.14.0 apache-airflow-providers-fab==1.1.1 apache-airflow-providers-ftp==3.9.1 apache-airflow-providers-http==4.11.1 apache-airflow-providers-imap==3.6.1 apache-airflow-providers-smtp==1.7.1 apache-airflow-providers-sqlite==3.8.1 ### Deployment Astronomer ### Deployment details local pip ### Anything else? , ### Are you willing to submit PR? - [ ] 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)
shahar1 commented 1 month ago

Recreated the issue after a reproducible example was provided in the discussion, see: https://github.com/apache/airflow/discussions/40113#discussioncomment-10869110