You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/09/16 04:16:26 UTC

[GitHub] [incubator-superset] mistercrunch commented on a change in pull request #8220: [sqllab] use celery worker for stop_query

mistercrunch commented on a change in pull request #8220: [sqllab] use celery worker for stop_query
URL: https://github.com/apache/incubator-superset/pull/8220#discussion_r324506558
 
 

 ##########
 File path: superset/views/core.py
 ##########
 @@ -2464,30 +2463,9 @@ def results(self, key):
     @has_access_api
     @expose("/stop_query/", methods=["POST"])
     @event_logger.log_this
-    @backoff.on_exception(
-        backoff.constant,
-        Exception,
-        interval=1,
-        on_backoff=lambda details: db.session.rollback(),
-        on_giveup=lambda details: db.session.rollback(),
-        max_tries=5,
-    )
     def stop_query(self):
         client_id = request.form.get("client_id")
-
-        query = db.session.query(Query).filter_by(client_id=client_id).one()
-        if query.status in [
-            QueryStatus.FAILED,
-            QueryStatus.SUCCESS,
-            QueryStatus.TIMED_OUT,
-        ]:
-            logging.error(
-                f"Query with client_id {client_id} could not be stopped: query already complete"
-            )
-            return self.json_response("OK")
-        query.status = QueryStatus.STOPPED
-        db.session.commit()
-
+        sql_lab.stop_query.delay(client_id)
 
 Review comment:
   There may not be a message queue, setting up Celery should be optional to simplify installation in modest or early environments

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org