"""Invoke adjustment_file_import lambda task method.""" from hooks.lambda_hook import OrchLambdaHook from lib import config from tasks.adjustment_file_import import helpers def invoke_adjustment_file_import_lambda_task(dag_run, *arg, **kwargs): """Invoke lambda to import adjustment file content.""" event = helpers.get_event_from_params(dag_run, **kwargs) if config.OWS_ENV.lower() == 'qa': hook = OrchLambdaHook( config.ADJUSTMENT_FILE_IMPORT_LAMBDA_NAME, aws_conn_id='accounting_qa' ) else: hook = OrchLambdaHook(config.ADJUSTMENT_FILE_IMPORT_LAMBDA_NAME) response = hook.invoke_lambda(event.to_json()) if not response.function_response.succeeded: raise Exception(response.error_message)