Foreword
Although lambdas provide an extremely wide range of capabilities, several different types have been introduced in order to streamline requirements, simplify the development and use of lambdas.
At the moment there standalone, handlers 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 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 luna-configurator service, which allows lambda to get its settings (logger settings for example). All other requirements are optional, see standalone lambda detailed description for more information.
Here is some examples of possible uses for standalone lambdas:
incoming images filtration and subsequent sending to Luna-Remote-SDK service
notification sender
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 luna-handler (see luna-handlers documentation for handlers description).
It must be designed for processing requests from luna-handlers service.
Detailed description of 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 custom handler, which has its own reply schema, which can be different from canonical luna-handlers response and cannot be properly used in other luna-platform services
as custom handler, which mimics its response to canonical luna-platform handler, there are some requirements for such lambda:
lambda response must match the luna-handlers response schema (events generation request, see luna-handlers openapi documentation for details)
lambda must properly process incoming data for other services can use this handler, otherwise there is no guarantee of compatibility with other luna-platform services (if handler implies face detection - lambda must return face detection in response, if handler implies body detection - lambda must return body detection in response, etc)
For example, if lambda satisfies the above conditions, it can be used in estimator task as canonical luna-handler.
Here is 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 matching functionality
using beta features of LUNA SDK which are not already implemented by Luna Platform
The handlers lambda also may be used outside the kubernetes cluster using luna-lamda as proxy by lambda proxy requests. For more information see lambda usage.
Tasks
Luna-Platform includes 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 luna-tasks developer documentation for 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 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 the list if faces are not similar to the specified face
remove duplicates from the faces list
recursively find events similar to 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.