Foreword
Note
For a comprehensive reference of all available functions, classes, and constants for each lambda type, see the Lambda reference table.
Although lambdas provide an extremely wide range of capabilities, several different types have been introduced in order to streamline the requirements, simplify the development and use of lambdas.
Lambdas can be shared or not shared. Shared means that it can be used by others users (if it is not an external agent, then means its analysts). If it is not shared, then other users can’t use it.
At the moment there are standalone, handlers, agent and tasks lambdas.
Note
Every lambda has some requirements for luna-services, whose actual settings will be automatically used for requests processing. The settings reload mechanism for every lambda is the same as for each luna-service with the exception of config-reload, which is enabled by default for lambda. For more information about configuration, see the configuration chapter.
Note
More lambda type(s) can be added in the future.
Standalone
The standalone lambda assumes separate work and is designed to process requests sent directly to the lambda itself.
The necessary requirement is the luna-configurator service, which allows the lambda to get its settings (logger settings for example). All other requirements are optional; see the standalone lambda detailed description for more information.
Here are some examples of possible uses for standalone lambdas:
incoming images filtration and subsequent sending to the Luna-Remote-SDK service
notification sender
a video stream reader which split stream into files and save to Luna-Image-Store for post processing using Face Stream
The standalone lambda may be used outside the kubernetes cluster using luna-lamda as proxy by lambda proxy requests. For more information, see lambda usage.
Handlers
The handlers lambda assumes work as a luna-handler (see the luna-handlers documentation for handlers description).
It must be designed for processing requests from the luna-handlers service.
A detailed description of the handlers lambda additional requirements, request structure and other details describes at handlers lambda detailed description.
The handlers lambda can be used in two different ways:
as a custom handler, which has its own reply schema, which can be different from the canonical luna-handlers response and cannot be properly used in other luna services
as a custom handler, which mimics its response to canonical luna handler, there are some requirements for such a lambda:
the lambda response must match the luna-handlers response schema (events generation request, see the luna-handlers openapi documentation for details)
the lambda must properly process incoming data for other services can use this handler, otherwise there is no guarantee of compatibility with other luna services (if the handler implies face detection - lambda must return face detection in the response, if handler implies body detection - lambda must return body detection in the response, etc)
For example, if a lambda satisfies the above conditions, it can be used in the estimator task as a canonical luna-handler.
Here are some examples of possible uses for handlers lambdas:
verification with event saving
comparison of two images and returning similarity without any data saving
adding custom filtration logic to the matching functionality
using beta features of the LUNA SDK which are not already implemented in the product
The handlers lambda can also be used outside the kubernetes cluster using luna-lamda as proxy by lambda proxy requests. For more information, see lambda usage.
Agent
The Product contains some services to process streams and video files using video analytics: Luna-Video-Manager and Luna-Video-Agent. The Luna-Video-Manager service is intended for streams distribution among agents and subsequent analysis of streams. The Luna-Video-Agent service is intended for streams and video files analytics. There may be more than one video-agents which can process different video analytics, i.e. lambda agent.
The agent lambda assumes work as a luna-video-agent (see the luna-video-agent and luna-video-manager documentation for more description) with the different that its allow to process another user-specified analytics on streams and videos.
A detailed description of the agent lambda additional requirements and other details describes at agent lambda detailed description.
The agent lambda is not intended to process any user requests directly and works only in conjunction with luna-video-manager.
Tasks
The product includes the Luna-Tasks service. Basically Luna-Tasks contains in two parts: Task Router and Task Worker.
The tasks lambda assumes additional custom long task types (see the luna-tasks developer documentation for the basic principles of service working and builtin tasks detailed description, available here).
Superficial description of task processing:
separate task to subtask
process subtask
collect and merge the subtask results
Detailed task processing description available here
The lambda task allows to make new type of task with its own logic playing role of task worker with the same restrictions by realizing task content separation and subtask content processing.
Here are some examples of possible uses for tasks lambdas:
unlink faces from a list if the faces are not similar to a specified face
remove duplicates from the faces list
recursively find events similar to a specified photo
The tasks lambda cannot be used outside the kubernetes cluster using luna-lambda as proxy and does not imply usage by lambda proxy requests.