vishal-m-patil-db opened a new issue, #33866:
URL: https://github.com/apache/airflow/issues/33866
### Apache Airflow version
Other Airflow 2 version (please specify below)
### What happened
2.2.5 and 2.5.3
### What you think should happen instead
Timeout should be calculated based on current run start_date and not
start_date from previous runs which can range from any day
### How to reproduce
Create parent_dag with below task
` task1= PythonOperator(
task_id='task1',
provide_context=True,
python_callable=lambda: time.sleep(60),
)`
Create child_dag with below default_args (retries=3) and task
`default_args = {'depends_on_past': False,
'email_on_failure': False,
'email_on_retry': False,
'owner': 'Composer',
'project_id': 'test',
'region': 'europe-west3',
'retries': 3}`
` parent_sensor = ExternalTaskSensor(
task_id='parent_sensor',
external_dag_id='parent_dag',
external_task_id='task1',
mode='reschedule',
timeout=300,
execution_date_fn=lambda dt: dt
)`
If these dags are ran/reran multiple times and then timeout is calculated as
current_end_date - start_date of run attempt 3 times before.
For Ex. 1st child run is on 1-Aug, 2nd child run is on 5th Aug, 3rd child
run is on 6th Aug, and if child dag is triggerred in 7th Aug, it calculates
timeout as 7th Aug end_date -1st Aug start_date which is 518400 instead of
calculating timeout as 7th Aug end_date of current run-7th AUg start_date of
current run.
The problem seems to be in airflow code
https://github.com/apache/airflow/blob/main/airflow/sensors/base.py#L214
here its substracting self.retries from max tries and hence instead of
current run start_date its going start_date for 3 runs back.
### Operating System
Cloud Composer
### Versions of Apache Airflow Providers
_No response_
### Deployment
Google Cloud Composer
### 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]