mattellis edited a comment on issue #14265:
URL: https://github.com/apache/airflow/issues/14265#issuecomment-791091325


   @YangMuye @kaxil 
   Our users have the same issue. In case it's of use, I figured out that the 
`models.dag.clear` method being invoked when a dag run is cleared from the 
graph or tree view, does not set the `activate_dag_runs` flag to True in the 
`models.taskinstance.clear_task_instances` method, which is where the 
start_date value for the run is reset to now():
   
https://github.com/apache/airflow/blob/09327ba6b371aa68cf681747c73a7a0f4968c173/airflow/models/dag.py#L1328
   
   ```
   if activate_dag_runs and tis:
   ...
       dr.start_date = timezone.utcnow()
   ```
   
https://github.com/apache/airflow/blob/09327ba6b371aa68cf681747c73a7a0f4968c173/airflow/models/taskinstance.py#L221
   
   Alternatively, the browse DAG runs view uses a different path to clear dag 
runs, and is still effective in resetting the dagrun start date:
   
https://github.com/apache/airflow/blob/09327ba6b371aa68cf681747c73a7a0f4968c173/airflow/www/views.py#L3429
   
   We've advised our users to use this method as a workaround for now, and set 
our normal 24 hour dag_run timeout to 7 days to cover most common use cases of 
clearing recently failed runs.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to