From 3a58424e62592ead7d05eb64a351c21f8305e6ab Mon Sep 17 00:00:00 2001 From: Daniel Vaz Gaspar Date: Tue, 11 Jan 2022 09:30:20 +0000 Subject: [PATCH] fix: API logger output (#17981) * fix: Improve logger messages on core API * revert package.json change * fix * black * improve log message * improve message --- superset/views/core.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/superset/views/core.py b/superset/views/core.py index ecbd13df32673..ca7dae3ee51e7 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -2014,10 +2014,7 @@ def sync_druid_source(self) -> FlaskResponse: # pylint: disable=no-self-use ] DruidCluster = DruidDatasource.cluster_class # pylint: disable=invalid-name if not user: - err_msg = __( - "Can't find User '%(name)s', please ask your admin " "to create one.", - name=user_name, - ) + err_msg = __("Can't find user, please ask your admin to create one.") logger.error(err_msg, exc_info=True) return json_error_response(err_msg) cluster = ( @@ -2026,10 +2023,7 @@ def sync_druid_source(self) -> FlaskResponse: # pylint: disable=no-self-use .one_or_none() ) if not cluster: - err_msg = __( - "Can't find DruidCluster with cluster_name = " "'%(name)s'", - name=cluster_name, - ) + err_msg = __("Can't find DruidCluster") logger.error(err_msg, exc_info=True) return json_error_response(err_msg) try: @@ -2377,7 +2371,6 @@ def results_exec(key: str) -> FlaskResponse: ) def stop_query(self) -> FlaskResponse: 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, @@ -2385,9 +2378,7 @@ def stop_query(self) -> FlaskResponse: QueryStatus.TIMED_OUT, ]: logger.warning( - "Query with client_id %s could not be stopped: " - "query already complete", - str(client_id), + "Query with client_id could not be stopped: query already complete", ) return self.json_response("OK")