KeeganCarter11 opened a new issue, #36100:
URL: https://github.com/apache/airflow/issues/36100

   ### Apache Airflow version
   
   2.7.3
   
   ### What happened
   
   While using this variable from context ex: 
`last_dag_success=context.get('prev_execution_date_success')`  I get the below 
warning. This suggests using prev_data_interval_start_success however this is 
NOT an equivalent date_time. The first is the date_time for which the DAG most 
recently had a successful run _including manual runs_. The latter is the 
_assumed_ last successful start of a run based on the data interval. 
   
   `{{logging_mixin.py:151}} WARNING - 
/usr/local/***/.local/lib/python3.11/site-packages/***/utils/context.py:314 
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.`
   
   ### What you think should happen instead
   
   [Reading 
documentation](https://airflow.apache.org/docs/apache-airflow/stable/templates-ref.html#templates-variables)
 it seems like this should direct users to prev_start_date_success since that 
is defined as "Start date from prior successful DagRun (if available)." however 
that variable also doesn't seem to behave as expected. In my example dag below 
running the dag multiple times manually even though it succeeds this variable 
never updates from None
   
![image](https://github.com/apache/airflow/assets/71595294/98ec973d-bed3-4bdf-a9f9-32d9e69f1aa0)
   
   
   ### How to reproduce
   
   Below sample dag that shows this behavior. Run it a couple of times and 
watch the date-times in the logs. Something is weird here. 
   
   ```
   from datetime import datetime, timedelta
   from airflow.decorators import task, dag
   default_args = {
       'start_date': datetime(2023, 9, 12),
       'retries': 0,
       'retry_delay': timedelta(minutes=15)
   }
   @dag(dag_id="AAA_Context_Example",
        tags=["example"],
        catchup=False,
        default_args=default_args,
        schedule_interval="01 0 * * *"
        )
   def main():
       @task()
       def example(**context):
           print(f"prev_execution_date_success: 
{context.get('prev_execution_date_success')}")
           print(f"prev_start_date_success : 
{context.get('prev_start_date_success ')}")
           print(f"prev_data_interval_start_success: 
{context.get('prev_data_interval_start_success')}")
       example()
   dag = main()
   ```
   
   
   ### Operating System
   
   MWAA
   
   ### Versions of Apache Airflow Providers
   
   NA
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   MWAA / Local runner testing 7.3
   
   ### Anything else
   
   _No response_
   
   ### 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)
   


-- 
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: [email protected]

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

Reply via email to