fix: API logger output (#17981)

* fix: Improve logger messages on core API

* revert package.json change

* fix

* black

* improve log message

* improve message
This commit is contained in:
Daniel Vaz Gaspar 2022-01-11 09:30:20 +00:00 committed by GitHub
parent 44df04f15d
commit 3a58424e62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 12 deletions

View File

@ -2014,10 +2014,7 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
]
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 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
.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 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
)
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 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
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")