BasPH opened a new issue, #59609:
URL: https://github.com/apache/airflow/issues/59609
### Description
A user ran this code in Airflow 2:
```python
prev_ti = ti.get_previous_ti(state='success')
# do something with prev_ti.start_date
```
This doesn't work anymore on Airflow 3, since the context gives a
`RuntimeTaskInstance` with limited functionality. I found the business logic:
1. Fetches the previous successful DagRun, and
2. Returns the corresponding task instance (regardless state, which is a bit
odd, but not the point right now).
Step 1 is reproducible in Airflow 3:
```python
@task
def test(ti: RuntimeTaskInstance):
prev_dagrun = ti.get_previous_dagrun(state=DagRunState.SUCCESS)
```
But step 2 is not, there's no way to fetch a specific task from that object.
Can we introduce an Airflow 3-equivalent?
### Use case/motivation
Migrate to Airflow 3
### Related issues
_No response_
### Are you willing to submit a 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]