You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2022/02/22 07:20:50 UTC

[superset] branch master updated: stop query on the processing engine when user clicks STOP on SQL Lab (#18789)

This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new d632590  stop query on the processing engine when user clicks STOP on SQL Lab (#18789)
d632590 is described below

commit d632590eff8dedb31ecf01e6f610f098b7cfea48
Author: saurabh gulati <sa...@gmail.com>
AuthorDate: Tue Feb 22 08:19:34 2022 +0100

    stop query on the processing engine when user clicks STOP on SQL Lab (#18789)
    
    Co-authored-by: Saurabh Gulati <sa...@fedex.com>
---
 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 51becd7..611a984 100644
--- a/superset/db_engine_specs/hive.py
+++ b/superset/db_engine_specs/hive.py
@@ -335,6 +335,10 @@ class HiveEngineSpec(PrestoEngineSpec):
         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()