jina.clients.helper module#
Helper functions for clients in Jina.
- jina.clients.helper.pprint_routes(resp, stack_limit=3)[source]#
Pretty print routes with
prettytable
, fallback toprint()
.- Parameters
resp (
Response
) – theResponse
objectstack_limit (
int
) – traceback limit
- jina.clients.helper.callback_exec(response, on_done, on_error, on_always, continue_on_error, logger)[source]#
Execute the callback with the response.
- Parameters
response – the response
on_done (
Callable
) – the on_done callbackon_error (
Callable
) – the on_error callbackon_always (
Callable
) – the on_always callbackcontinue_on_error (
bool
) – whether to continue on errorlogger (
JinaLogger
) – a logger instance
- Return type
None
- jina.clients.helper.callback_exec_on_error(on_error, exception, logger, response=None)[source]#
Execute the on_error callback with the response, Use when an error outside the response status was thrown. :param on_error: the on_error callback :param exception: the exception with was thrown and led to the call of on_error :param logger: a logger instance :param response: the response