Core class for other components to inherit.View Licence Agreement
Core Processor class template. All the main components (Worker, Orchestrator and Scheduler) inherit from this one. You can also use this class as parent for some of your standalone Lambdas, but we strictly encourage you to use Worker class in case you are running functions under sosw orchestration.
Logs current Processor stats and message. Then raises RuntimeError with message.
If there is access to publish SNS messages, the method will also try to publish to the topic configured as dead_sns_topic or ‘SoswWorkerErrors’.
Parameters: message (str) – Description of failure.
Returns config by name from SSM. Override this to provide your config handling method.
Parameters: name – Name of the config Return type: dict
get_stats(recursive: bool = True)¶
Return statistics of operations performed by current instance of the Class.
Statistics of custom clients existing in the Processor is also aggregated by default. Clients must be initialized as self.some_client ending with _client suffix (e.g. self.dynamo_client). Clients must also have their own get_stats() methods implemented.
Be careful about circular get_stats() calls from child classes. If required overwrite get_stats() with recursive = False.
Parameters: recursive – Merge stats from self.***_client. Return type: dict Returns: Statistics counter of current Processor instance.
reset_stats(recursive: bool = True)¶
Cleans statistics other than specified for the lifetime of processor. All the parameters with prefix ‘total_’ are also preserved.
The function makes sense if your Processor lives outside the scope of lambda_handler.
Be careful about circular get_stats() calls from child classes. If required overwrite reset_stats() with recursive = False.
Parameters: recursive – Reset stats from self.***_client.
Global placeholder for global_vars that we want to preserve in the lifetime of the Lambda Container. e.g. once initiailised the given Processor, we keep it alive in the container to minimize warm-run time.
This namespace also contains the lambda_context which should be reset by get_lambda_handler method. See Worker examples in documentation for more info.
get_lambda_handler(processor_class, global_vars=None, custom_config=None)¶
Return a reference to the entry point of the lambda function.
- processor_class – Callable processor class.
- global_vars – Lambda’s global variables (processor, context).
- custom_config – Custom configuration to pass the processor constructor.
Function reference for the lambda handler.