Skip to content

Commit

Permalink
fix: API logger output (apache#17981)
Browse files Browse the repository at this point in the history
* fix: Improve logger messages on core API

* revert package.json change

* fix

* black

* improve log message

* improve message
  • Loading branch information
dpgaspar authored and bwang221 committed Feb 10, 2022
1 parent cf35602 commit 9b8cb53
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand All @@ -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:
Expand Down Expand Up @@ -2377,17 +2371,14 @@ 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,
QueryStatus.SUCCESS,
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")

Expand Down

0 comments on commit 9b8cb53

Please sign in to comment.