You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ep...@apache.org on 2021/08/17 08:38:13 UTC
[airflow] branch main updated: Fix wrong query on running tis
(#17631)
This is an automated email from the ASF dual-hosted git repository.
ephraimanierobi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 84df864 Fix wrong query on running tis (#17631)
84df864 is described below
commit 84df8646ba396088e70ca8469b301d11d13d2da7
Author: Ephraim Anierobi <sp...@gmail.com>
AuthorDate: Tue Aug 17 09:37:56 2021 +0100
Fix wrong query on running tis (#17631)
Fix wrong query on my PR about deleting running dags #17630
Co-authored-by: Kaxil Naik <ka...@gmail.com>
---
airflow/api/common/experimental/delete_dag.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/airflow/api/common/experimental/delete_dag.py b/airflow/api/common/experimental/delete_dag.py
index eb45384..44e54e3 100644
--- a/airflow/api/common/experimental/delete_dag.py
+++ b/airflow/api/common/experimental/delete_dag.py
@@ -42,7 +42,10 @@ 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)
+ .first()
)
if running_tis:
raise AirflowException("TaskInstances still running")