ferruzzi commented on code in PR #62494:
URL: https://github.com/apache/airflow/pull/62494#discussion_r2875569155
##########
airflow-core/docs/howto/deadline-alerts.rst:
##########
@@ -221,13 +224,32 @@ Here's an example using the Slack Notifier if the Dag run
has not finished withi
):
EmptyOperator(task_id="example_task")
+Here's the same example using a **synchronous callback**. The callback runs in
the executor:
+
+.. code-block:: python
+
+ with DAG(
+ dag_id="slack_deadline_alert_sync",
+ deadline=DeadlineAlert(
+ reference=DeadlineReference.DAGRUN_QUEUED_AT,
+ interval=timedelta(minutes=30),
+ callback=SyncCallback(
+ SlackWebhookNotifier,
+ kwargs={
+ "text": "🚨 Dag {{ dag_run.dag_id }} missed deadline at {{
deadline.deadline_time }}. DagRun: {{ dag_run }}"
+ },
+ ),
+ ),
+ ):
+ EmptyOperator(task_id="example_task")
+
Creating Custom Callbacks
^^^^^^^^^^^^^^^^^^^^^^^^^
You can create custom callables for more complex handling. If ``kwargs`` are
specified in the ``Callback``,
they are passed to the callback function. **Asynchronous callbacks** must be
defined somewhere in the
-Triggerer's system path.
+Triggerer's system path. **Synchronous callbacks** must be defined in the
executor's path.
Review Comment:
I miss that distinction all the time. Thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]