"""Merge Label Participant nodes.""" import config from constants import error from lambdacommon.common_config import logger from logic import label_participant as label_participant_logic import sentry_sdk from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration sentry_sdk.init( config.SENTRY_DSN, integrations=[AwsLambdaIntegration()] ) def handler(event, context): """Lambda entry point.""" logger.info(event) if not event.get('master_node_uuid') or not event.get('child_node_uuids'): logger.error(error.EVENT_ERROR_MESSAGE) return {'status': 'Fail'} try: child_node_uuids = list(map(str, event.get('child_node_uuids'))) master_node_uuid = str(event.get('master_node_uuid')) label_participant_logic.merge_lp_nodes( master_node_uuid, child_node_uuids) except Exception as e: logger.exception(str(e)) raise e return {'status': 'OK'}