When running a Python script using BashOperator
of Airflow 1.10.9,
task_1 = BashOperator(
task_id='task_1',
bash_command='/path/to/env/python /path/to/task_1.py'
dag=dag)
what can be done inside the Python script to signal to Airflow that this task has failed?
task_1.py
if __name__ == '__main__':
print('Task failed!')
# How do we tell Airflow that the `task_1` has failed?
Raise a Python Exception that should send exit code of 1 to BashOperator which should fail.