"""Invoke ledger accounting run balance lambda task method.""" from hooks.lambda_hook import OrchLambdaHook from lib import config from tasks.accounting_run_calculate_nr import helpers def invoke_ledger_accounting_run_balance_lambda_task(dag_run: dict, **kwargs) -> None: """Invoke lambda to populate ledger_accounting_run_balance table from snowflake. Args: dag_run (dict): config of the DAG within which this task will run kwargs (dict): any other optional arguments """ event = helpers.get_event_from_params(dag_run, **kwargs) hook = OrchLambdaHook(config.LEDGER_ACCOUNTING_RUN_BALANCE_LAMBDA_NAME) response = hook.invoke_lambda(event.to_json()) if not response.function_response.succeeded: raise Exception(response.error_message)