"""Invoke reserves_release lambda task method.""" from hooks.lambda_hook import OrchLambdaHook from lib import config from tasks.reserves_release import helpers def invoke_reserves_release_lambda_task(dag_run, *arg, **kwargs): """Invoke lambda to credit back reserve amount.""" event = helpers.get_event_from_params(dag_run, **kwargs) hook = OrchLambdaHook(config.RESERVES_RELEASE_LAMBDA_NAME) response = hook.invoke_lambda(event.to_json()) if not response.function_response.succeeded: raise Exception(response.error_message)