You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/08/16 14:57:02 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #17631: Fix wrong query on running tis

kaxil commented on a change in pull request #17631:
URL: https://github.com/apache/airflow/pull/17631#discussion_r689611887



##########
File path: airflow/api/common/experimental/delete_dag.py
##########
@@ -42,7 +42,11 @@ def delete_dag(dag_id: str, keep_records_in_log: bool = True, session=None) -> i
     """
     log.info("Deleting DAG: %s", dag_id)
     running_tis = (
-        session.query(models.TaskInstance.state).filter(models.TaskInstance.state.in_(State.unfinished)).all()
+        session.query(models.TaskInstance.state)
+        .filter(models.TaskInstance.dag_id == dag_id)
+        .filter(models.TaskInstance.state == State.RUNNING)
+        .limit(1)
+        .count()

Review comment:
       Wait "limit 1" and count does not make sense to me




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