jina.serve.executors.decorators module#

Decorators and wrappers designed for wrapping BaseExecutor functions.

jina.serve.executors.decorators.wrap_func(cls, func_lst, wrapper)[source]#

Wrapping a class method only once, inherited but not overridden method will not be wrapped again

Parameters
  • cls – class

  • func_lst – function list to wrap

  • wrapper – the wrapper

jina.serve.executors.decorators.store_init_kwargs(func)[source]#

Mark the args and kwargs of __init__() later to be stored via save_config() in YAML :type func: Callable :param func: the function to decorate :rtype: Callable :return: the wrapped function

jina.serve.executors.decorators.requests(func=None, *, on=None)[source]#

@requests defines when a function will be invoked. It has a keyword on= to define the endpoint.

A class method decorated with plan @requests (without on=) is the default handler for all endpoints. That means, it is the fallback handler for endpoints that are not found.

Parameters
  • func (Callable[[ForwardRef, Dict, ForwardRef, List[ForwardRef], List[ForwardRef]], Union[ForwardRef, Dict, None]]) – the method to decorate

  • on (Union[str, Sequence[str], None]) – the endpoint string, by convention starts with /

Returns

decorated function