You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "o-nikolas (via GitHub)" <gi...@apache.org> on 2026/03/02 21:19:47 UTC
Re: [PR] Docs updates for Deadlines for 3.2 [airflow]
o-nikolas commented on code in PR #62494:
URL: https://github.com/apache/airflow/pull/62494#discussion_r2874699659
##########
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:
Is this true? They don't run inside the executor class anymore. They must be on the path of the worker (whatever that means for each specific executor).
##########
airflow-core/docs/howto/deadline-alerts.rst:
##########
@@ -237,6 +259,63 @@ Triggerer's system path.
Nested callables are not currently supported.
* The Triggerer will need to be restarted when a callback is added or changed in order to reload the file.
+.. note::
+ Regarding Synchronous callbacks:
+
+ * Sync callbacks are sent to the executor and treated just like a Dag task with top priority.
+
+
+A **custom synchronous callback** might look like this:
+
+1. Place this method in ``/files/plugins/deadline_callbacks.py``:
Review Comment:
This is a very Breeze specific path. Maybe something more agnostic?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org