"""Lambda commit_ledger_account_contract function module.""" from datetime import datetime import sentry_sdk from lambdacommon.common_config import logger from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration import config from commit_ledger_account_contract.processor import CommitLedgerProcessor if config.SENTRY_DSN: sentry_sdk.init( dsn=config.SENTRY_DSN, environment=config.ENVIRONMENT, integrations=[AwsLambdaIntegration(timeout_warning=True)], ) def handler(event, context): """Lambda entry point.""" try: processor = CommitLedgerProcessor(event) start_time = datetime.now() processor.process() end_time = datetime.now() diff = end_time - start_time logger.info(f'Finished processing in {diff}') return {'status': 'OK'} except Exception as e: logger.exception(str(e)) raise e