jina.executors.decorators module

Decorators and wrappers designed for wrapping BaseExecutor functions.

jina.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

  • cls – class

  • func_lst – function list to wrap

  • wrapper – the wrapper


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.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.

  • 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 /


decorated function