Google Cloud Composer 在失败时调用 API

Google Cloud Composer call an API on failure

我在 Google Cloud Composer 上有一个 DAG 运行。这个 DAG 正在我们的 BigQuery 之上执行一些操作(我们正在使用 airflow.contrib.operators.bigquery_operator.BigQueryOperator)如果 DAG 出现故障,我想调用 Error Reporting API,但是,我不知道如何去做。

答案是在 DAG args 中使用 on_failure_callback 参数。这是一篇关于如何使用它的非常好的入门级文章:https://forum.astronomer.io/t/how-can-i-set-my-on-failure-and-on-success-callbacks-to-have-the-task-context/182