MetaHandler

Meta Handler is an optional collector of all the events that were happening to the task while being orchestrated by sosw. In case you create a DynamoDB table sosw_tasks_meta in your environment, sosw will start collecting the meta data automatically. The required schema for the table is described in sosw/examples/yaml/initial/sosw-dev-shared-dynamodb.yaml .

The setup script will create the table by default.

MetaHandler can also be automatically initialised by classes, inheriting from Worker. They will then write 'completed' and 'failed' events to the DynamoDB tasks meta data table. In order to enable this feature, you have to provide 'meta_handler_config' in your custom_config. You will also need to grant write permissions for this table to your Lambda.

Config example:

{
    'meta_handler_config': {
        'write_meta_to_ddb': True,
        'dynamo_db_config': {
            'table_name':      'sosw_tasks_meta'
        }
    }
}
View Licence Agreement

class sosw.managers.meta_handler.MetaHandler(custom_config: Dict | None = None, **kwargs)[source]

MetaHandler is helper class for Essential classes. It works with DynamoDB table to store the meta data of operations on Tasks.

post(task_id: str, action: str, **kwargs)[source]

Write row with meta data to sosw_tasks_meta DynamoDB Table if configured. As long as collecting the meta data is optional, the MetaHandler will either save it to DynamoDB or just log.

MetaHandler does not restrict the fields and actions you can post from your Worker Lambdas with the exception of the following built-in fields. These ones are always taken from the current lambda_context automatically.

  • 'author'

  • 'invocation_id'

  • 'log_stream_name'