From 5805fb3cfbce632b8cda38e8bfa5650f19517ca1 Mon Sep 17 00:00:00 2001 From: Saurabh Gulati Date: Thu, 17 Feb 2022 17:17:48 +0100 Subject: [PATCH] stop query on the processing engine when user clicks STOP on SQL Lab --- superset/db_engine_specs/hive.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/superset/db_engine_specs/hive.py b/superset/db_engine_specs/hive.py index 51becd770546e..611a98448b2ce 100644 --- a/superset/db_engine_specs/hive.py +++ b/superset/db_engine_specs/hive.py @@ -335,6 +335,10 @@ def handle_cursor( # pylint: disable=too-many-locals job_id = None query_id = query.id while polled.operationState in unfinished_states: + # Queries don't terminate when user clicks the STOP button on SQL LAB. + # Refresh session so that the `query.status` modified in stop_query in + # views/core.py is reflected here. + session.refresh(query) query = session.query(type(query)).filter_by(id=query_id).one() if query.status == QueryStatus.STOPPED: cursor.cancel()