You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "dimberman (via GitHub)" <gi...@apache.org> on 2023/02/13 05:15:03 UTC

[GitHub] [airflow] dimberman commented on a diff in pull request #29065: When clearing task instances try to get associated DAGs from database

dimberman commented on code in PR #29065:
URL: https://github.com/apache/airflow/pull/29065#discussion_r1104005421


##########
airflow/models/taskinstance.py:
##########
@@ -181,6 +182,7 @@ def clear_task_instances(
     task_id_by_key: dict[str, dict[str, dict[int, dict[int, set[str]]]]] = defaultdict(
         lambda: defaultdict(lambda: defaultdict(lambda: defaultdict(set)))
     )
+    dag_bag = DagBag(read_dags_from_db=True)

Review Comment:
   ```ti_dag = dag if dag and dag.dag_id == ti.dag_id else dag_bag.get_dag(ti.dag_id, session=session)``` 
   
   Looks like dag is optional because if there is no DAG we can just get the DAG from the TaskInstance



-- 
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: commits-unsubscribe@airflow.apache.org

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