"""Invoke lambda to synch contracts with legacy system.""" from datetime import datetime from airflow import DAG from airflow.operators.python import PythonOperator from lib import constants from tasks.apply_adjustments.invoke_abacus_adjustments_apply_lambda import \ invoke_abacus_adjustments_apply_lambda_task from tasks.apply_adjustments.notify_failure import notify_failure_task from tasks.apply_adjustments.notify_started import notify_started_task from tasks.apply_adjustments.notify_success import notify_success_task dag = DAG( constants.DAG_APPLY_ADJUSTMENTS_NAME, description='Apply pending adjustments', start_date=datetime(2019, 1, 1), default_args={'provide_context': True}, schedule_interval=None ) """ ###################################################################### ############################# OPERATORS ############################## ###################################################################### """ invoke_abacus_adjustments_apply_lambda_operator = PythonOperator( task_id='invoke_abacus_adjustments_apply_lambda', python_callable=invoke_abacus_adjustments_apply_lambda_task, dag=dag ) notify_failure_operator = PythonOperator( dag=dag, python_callable=notify_failure_task, task_id='notify_failure', trigger_rule='one_failed' ) notify_started_operator = PythonOperator( dag=dag, python_callable=notify_started_task, task_id='notify_started' ) notify_success_operator = PythonOperator( dag=dag, python_callable=notify_success_task, task_id='notify_success' ) notify_started_operator >> \ invoke_abacus_adjustments_apply_lambda_operator >> \ [notify_success_operator, notify_failure_operator]