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