cristian-fatu opened a new issue, #53628:
URL: https://github.com/apache/airflow/issues/53628

   ### Apache Airflow version
   
   3.0.3
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   Previously, in 2.9.2, I used the dag_run available in the task context and 
called get_previous_dagrun on it, but from what I understand in Airflow 3 the 
context holds a stripped down version of the dag_run, which no longer has the 
get_previous_dagrun method.
   Instead, in Airflow 3.0.2 the call fails with:
   `AttributeError: 'DagRun' object has no attribute 'get_previous_dagrun'`
   
   ### What you think should happen instead?
   
   I think there should be a get_previous_dagrun method as before. The reason I 
used this in 2.9.2 was to get the state of the previous DagRun and based on the 
current and previous state decided whether to send a notification or not (e.g.: 
if a DAG fails, we might only care to get a notification on the first failure 
or when it recovers, not in between)
   
   ### How to reproduce
   
   For reference, the code that works in 2.9.2 looks like this:
   `crt_dag_run = context["dag_run"]
    previous_dag_run = crt_dag_run.get_previous_dagrun(dag_run=crt_dag_run)`
   
   In v3, the DagRun that I get is of type 
airflow.sdk.api.datamodels._generated.DagRun which doesn't contain the 
get_previous_dagrun method.
   
   ### Operating System
   
   Debian GNU/Linux 12 (bookworm)
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-cncf-kubernetes  10.6.1
   apache-airflow-providers-standard         1.4.0
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### 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