mirror of
https://github.com/clearml/clearml-server
synced 2025-06-26 23:15:47 +00:00
Better handling of stack trace report on 500 error
This commit is contained in:
parent
158da9b480
commit
6488dc54e6
@ -57,6 +57,7 @@ class AuthBLL:
|
|||||||
api_version=str(ServiceRepo.max_endpoint_version()),
|
api_version=str(ServiceRepo.max_endpoint_version()),
|
||||||
server_version=str(get_version()),
|
server_version=str(get_version()),
|
||||||
server_build=str(get_build_number()),
|
server_build=str(get_build_number()),
|
||||||
|
feature_set="basic",
|
||||||
)
|
)
|
||||||
|
|
||||||
return GetTokenResponse(token=token.decode("ascii"))
|
return GetTokenResponse(token=token.decode("ascii"))
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
debug: false # Debug mode
|
debug: false # Debug mode
|
||||||
pretty_json: false # prettify json response
|
pretty_json: false # prettify json response
|
||||||
return_stack: true # return stack trace on error
|
return_stack: true # return stack trace on error
|
||||||
log_calls: true # Log API Calls
|
return_stack_to_caller: true # top-level control on whether to return stack trace in an API response
|
||||||
|
|
||||||
# if 'return_stack' is true and error contains a status code, return stack trace only for these status codes
|
# if 'return_stack' is true and error contains a status code, return stack trace only for these status codes
|
||||||
# valid values are:
|
# valid values are:
|
||||||
|
|||||||
@ -588,13 +588,18 @@ class APICall(DataContainer):
|
|||||||
self._end_ts = time.time()
|
self._end_ts = time.time()
|
||||||
self._duration = int((self._end_ts - self._start_ts) * 1000)
|
self._duration = int((self._end_ts - self._start_ts) * 1000)
|
||||||
|
|
||||||
def get_response(self, include_stack: bool = False) -> Tuple[Union[dict, str], str]:
|
def get_response(self, include_stack: bool = None) -> Tuple[Union[dict, str], str]:
|
||||||
"""
|
"""
|
||||||
Get the response for this call.
|
Get the response for this call.
|
||||||
:param include_stack: If True, stack trace stored in this call's result should
|
:param include_stack: If True, stack trace stored in this call's result should
|
||||||
be included in the response (default is False)
|
be included in the response (default follows configuration)
|
||||||
:return: Response data (encoded according to self.content_type) and the data's content type
|
:return: Response data (encoded according to self.content_type) and the data's content type
|
||||||
"""
|
"""
|
||||||
|
include_stack = (
|
||||||
|
include_stack
|
||||||
|
if include_stack is not None
|
||||||
|
else config.get("apiserver.return_stack_to_caller", False)
|
||||||
|
)
|
||||||
|
|
||||||
def make_version_number(version: PartialVersion) -> Union[None, float, str]:
|
def make_version_number(version: PartialVersion) -> Union[None, float, str]:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -10,6 +10,7 @@ def extract_properties_to_lists(
|
|||||||
key_names: Sequence[str],
|
key_names: Sequence[str],
|
||||||
data: Sequence[dict],
|
data: Sequence[dict],
|
||||||
extract_func: Optional[Callable[[dict], Tuple]] = None,
|
extract_func: Optional[Callable[[dict], Tuple]] = None,
|
||||||
|
target_keys: Optional[Sequence[str]] = None,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
"""
|
"""
|
||||||
Given a list of dictionaries and names of dictionary keys
|
Given a list of dictionaries and names of dictionary keys
|
||||||
@ -20,9 +21,10 @@ def extract_properties_to_lists(
|
|||||||
:param extract_func: the optional callable that extracts properties
|
:param extract_func: the optional callable that extracts properties
|
||||||
from a dictionary and put them in a tuple in the order corresponding to
|
from a dictionary and put them in a tuple in the order corresponding to
|
||||||
key_names. If not specified then properties are extracted according to key_names
|
key_names. If not specified then properties are extracted according to key_names
|
||||||
|
:param target_keys: optional alternative keys to use in the target dictionary. must be equal in length to key_names.
|
||||||
"""
|
"""
|
||||||
if not data:
|
if not data:
|
||||||
return {k: [] for k in key_names}
|
return {k: [] for k in key_names}
|
||||||
|
|
||||||
value_sequences = zip(*map(extract_func or itemgetter(*key_names), data))
|
value_sequences = zip(*map(extract_func or itemgetter(*key_names), data))
|
||||||
return dict(zip(key_names, map(list, value_sequences)))
|
return dict(zip((target_keys or key_names), map(list, value_sequences)))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user