Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-07-01 Thread via GitHub


rapsealk commented on code in PR #66269:
URL: https://github.com/apache/airflow/pull/66269#discussion_r3505312551


##
task-sdk/src/airflow/sdk/__init__.pyi:
##
@@ -53,13 +53,21 @@ from airflow.sdk.definitions.asset import (
 from airflow.sdk.definitions.asset.access_control import AssetAccessControl as 
AssetAccessControl
 from airflow.sdk.definitions.asset.decorators import asset as asset
 from airflow.sdk.definitions.asset.metadata import Metadata as Metadata
+from airflow.sdk.definitions.callback import (

Review Comment:
   Thanks for the comment! I will separate the prs alongside the corresponding 
issues.



-- 
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]



Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-07-01 Thread via GitHub


Lee-W commented on code in PR #66269:
URL: https://github.com/apache/airflow/pull/66269#discussion_r3505134642


##
task-sdk/src/airflow/sdk/__init__.pyi:
##
@@ -53,13 +53,21 @@ from airflow.sdk.definitions.asset import (
 from airflow.sdk.definitions.asset.access_control import AssetAccessControl as 
AssetAccessControl
 from airflow.sdk.definitions.asset.decorators import asset as asset
 from airflow.sdk.definitions.asset.metadata import Metadata as Metadata
+from airflow.sdk.definitions.callback import (

Review Comment:
   I feel this should be a separate PR: one for, for example, Dag and one for 
the fix. I was confused when I see code changes in a example Dag pr. or we 
should at least rename the PR



-- 
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]



Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-06-25 Thread via GitHub


rapsealk commented on code in PR #66269:
URL: https://github.com/apache/airflow/pull/66269#discussion_r3474171027


##
task-sdk/src/airflow/sdk/__init__.pyi:
##
@@ -51,13 +51,21 @@ from airflow.sdk.definitions.asset import (
 )
 from airflow.sdk.definitions.asset.decorators import asset as asset
 from airflow.sdk.definitions.asset.metadata import Metadata as Metadata
+from airflow.sdk.definitions.callback import (
+AsyncCallback as AsyncCallback,
+SyncCallback as SyncCallback,

Review Comment:
   `SyncCallback` is a real public class in `airflow.sdk.definitions.callback` 
(sibling of `AsyncCallback`), so it's now declared in the type stub for 
completeness/consistency. It's independent of the example DAG, which uses 
`AsyncCallback`.
   
   ---
   Drafted-by: Claude Code (Opus 4.8) (no human review before posting)



##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example DAG demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]
+from airflow.sdk import DAG, AsyncCallback, DeadlineAlert, DeadlineReference, 
task
+
+log = logging.getLogger(__name__)
+
+
+async def notify_deadline_missed(**kwargs):
+"""Async callback executed by the Triggerer when the deadline is missed."""
+context = kwargs.get("context", {})
+dag_run = context.get("dag_run")
+log.warning("Deadline missed for dag_run=%s", dag_run)
+
+
+with DAG(
+dag_id="example_deadline_alert",
+description="Demonstrates DeadlineAlert with DAGRUN_LOGICAL_DATE 
reference.",
+schedule=None,
+start_date=pendulum.datetime(2025, 1, 1, tz="UTC"),
+catchup=False,
+tags=["example", "deadline"],
+deadline=DeadlineAlert(
+reference=DeadlineReference.DAGRUN_LOGICAL_DATE,

Review Comment:
   Good call — switched the example to `DeadlineReference.DAGRUN_QUEUED_AT` to 
avoid the delayed-run weirdness you flagged.
   
   ---
   Drafted-by: Claude Code (Opus 4.8) (no human review before posting)



##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example DAG demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]
+from airflow.sdk import DAG, AsyncCallback, DeadlineAlert, DeadlineReference, 
task
+
+log = logging.getLogger(__name__)
+
+
+async def notify_deadline_missed(**kwargs):
+"""Async callback executed by the Triggerer when the deadline is missed."""
+context = kwargs.get("context", {})
+dag_run = context.get("dag_run")
+log.warning("Deadline missed for dag_run=%s", dag_run)
+
+
+with DAG(
+dag_id="example_deadline_alert",
+description="Demonstrates DeadlineAlert with DAGRUN_LOGICAL_DATE 
reference.",
+schedule=None,
+start_date=pendulum.datetime(2025, 1, 1, tz="UTC"),
+catchup=False,
+tags=["example", "deadline"],
+deadline=DeadlineAlert(
+reference=DeadlineReference.DAGRUN_LOGICAL_DATE,
+interval=timedelta(hours=1),

Review Comment:
   Addressed — the interval is now `timedelta(seconds=30)` and the task sleeps 
60s, so running the example actually tri

Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-06-25 Thread via GitHub


potiuk commented on PR #66269:
URL: https://github.com/apache/airflow/pull/66269#issuecomment-4798268916

   @rapsealk — this PR has 2 unresolved review thread(s) that still look like 
they need your attention. Once you've addressed them (push changes and/or reply 
in-thread), please resolve the threads or reply to confirm, and give the 
reviewer a nudge for another look. Thanks!
   
   See the [PR quality 
criteria](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-quality-criteria).
   
   Automated first-pass triage note drafted by an AI-assisted tool — may 
get things wrong; once addressed, a real Apache Airflow maintainer takes the 
next look. ([why 
automated](https://github.com/apache/airflow/blob/main/contributing-docs/25_maintainer_pr_triage.md))
   
   ---
   Drafted-by: Claude Code (Opus 4.8); reviewed by @potiuk before posting
   


-- 
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]



Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-06-09 Thread via GitHub


potiuk commented on PR #66269:
URL: https://github.com/apache/airflow/pull/66269#issuecomment-4658517803

   @rapsealk — There are 5 unresolved review thread(s) on this PR, and you have 
engaged with each one (post-review commits and/or in-thread replies). Could you 
confirm whether you believe the feedback is fully addressed and the PR is ready 
for maintainer review confirmation?
   
   If yes, reply here (a short "yes / ready" is fine) and an Apache Airflow 
maintainer will pick the PR up from the review queue on the next sweep.
   
   If you are still working on a thread, please reply with what is outstanding 
so the threads stay unresolved on purpose.
   
   _Note: This comment was drafted by an AI-assisted triage tool and may 
contain mistakes. Once you have addressed the points above, an Apache Airflow 
maintainer — a real person — will take the next look at your PR. We use this 
[two-stage triage 
process](https://github.com/apache/airflow/blob/main/contributing-docs/25_maintainer_pr_triage.md#why-the-first-pass-is-automated)
 so that our maintainers' limited time is spent where it matters most: the 
conversation with you._


-- 
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]



Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-05-25 Thread via GitHub


potiuk commented on PR #66269:
URL: https://github.com/apache/airflow/pull/66269#issuecomment-4538522744

   @rapsealk A few things need addressing before review — see our [Pull Request 
quality 
criteria](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-quality-criteria).
   
   - :x: **Other failing CI checks**. See 
[docs](https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst).
   - :x: **Unresolved review comments**: 2 thread(s). See 
[docs](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-quality-criteria).
   
   No rush.
   
   ---
   
   _Note: This comment was drafted by an AI-assisted triage tool and may 
contain mistakes. Once you have addressed the points above, an Apache Airflow 
maintainer — a real person — will take the next look at your PR. We use this 
[two-stage triage 
process](https://github.com/apache/airflow/blob/main/contributing-docs/25_maintainer_pr_triage.md#why-the-first-pass-is-automated)
 so that our maintainers' limited time is spent where it matters most: the 
conversation with you._
   
   ---
   Drafted-by: Claude Code (Opus 4.7); reviewed by @potiuk before posting
   


-- 
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]



Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-05-18 Thread via GitHub


potiuk commented on PR #66269:
URL: https://github.com/apache/airflow/pull/66269#issuecomment-4476939394

   @rapsealk — There are 2 unresolved review threads on this PR from @ferruzzi. 
Could you either push a fix or reply in each thread explaining why the feedback 
doesn't apply? Once you believe the feedback is addressed, mark the thread as 
resolved so the reviewer isn't re-pinged needlessly. Thanks!
   
   ---
   
   _Note: This comment was drafted by an AI-assisted triage tool and may 
contain mistakes. Once you have addressed the points above, an Apache Airflow 
maintainer — a real person — will take the next look at your PR. We use this 
[two-stage triage 
process](https://github.com/apache/airflow/blob/main/contributing-docs/25_maintainer_pr_triage.md#why-the-first-pass-is-automated)
 so that our maintainers' limited time is spent where it matters most: the 
conversation with you._
   


-- 
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]



Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-05-14 Thread via GitHub


parkhojeong commented on code in PR #66269:
URL: https://github.com/apache/airflow/pull/66269#discussion_r3178597364


##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example DAG demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]

Review Comment:
   thanks for your reply! 
   
   i was confused bacause some files don't use `# [START ...` comment in 
exmpale_dags 
   
   here is the files not using `[START...]. 
   - tutorial_taskflow_api_virtualenv.py
   - example_asset_alias_with_no_taskflow.py
   
   but some files are using `[START ...`.
   
   for example_dags, is using `[START ...]` and `[END ...]` the convention?
   if it is right, I’ll handle the remaining convention updates in a separate 
PR! 



-- 
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]



Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-05-12 Thread via GitHub


rapsealk commented on code in PR #66269:
URL: https://github.com/apache/airflow/pull/66269#discussion_r3230798254


##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,62 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example Dag demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+import time
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]
+from airflow.sdk import DAG, AsyncCallback, DeadlineAlert, DeadlineReference, 
task
+
+log = logging.getLogger(__name__)
+
+
+async def notify_deadline_missed(**kwargs):
+"""Async callback executed by the Triggerer when the deadline is missed."""
+context = kwargs.get("context", {})
+dag_run = context.get("dag_run")
+log.warning("Deadline missed for dag_run=%s", dag_run)
+
+
+with DAG(
+dag_id="example_deadline_alert",
+description="Demonstrates DeadlineAlert with DAGRUN_QUEUED_AT reference.",
+schedule=None,
+start_date=pendulum.datetime(2025, 1, 1, tz="UTC"),
+catchup=False,
+tags=["example", "deadline"],
+deadline=DeadlineAlert(
+reference=DeadlineReference.DAGRUN_QUEUED_AT,
+interval=timedelta(seconds=30),
+callback=AsyncCallback(notify_deadline_missed),
+name="example_deadline",
+),
+) as dag:
+
+@task
+def hello_deadline():
+log.info("Hello from a Dag with a deadline!")
+# Sleep past the deadline (sync, not a deferred sensor) to keep the 
demo focused on DeadlineAlert.

Review Comment:
   @ferruzzi Thanks for the feedback! I’ll look into the comments you left soon.



-- 
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]



Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-05-11 Thread via GitHub


ferruzzi commented on code in PR #66269:
URL: https://github.com/apache/airflow/pull/66269#discussion_r3222755103


##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,62 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example Dag demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+import time
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]
+from airflow.sdk import DAG, AsyncCallback, DeadlineAlert, DeadlineReference, 
task
+
+log = logging.getLogger(__name__)
+
+
+async def notify_deadline_missed(**kwargs):
+"""Async callback executed by the Triggerer when the deadline is missed."""
+context = kwargs.get("context", {})
+dag_run = context.get("dag_run")
+log.warning("Deadline missed for dag_run=%s", dag_run)

Review Comment:
   Nitpick, feel free to ignore and resolve.   `context` is always inserted by 
Airflow so it may be more clear to the user if we present it this way:
   
   ```suggestion
   async def notify_deadline_missed(context: dict, **kwargs):
   """Async callback executed by the Triggerer when the deadline is 
missed."""
   dag_run = context.get("dag_run")
   log.warning("Deadline missed for dag_run=%s", dag_run)
   ```
   
   But I'll leave it up to you, I don't feel too strongly about it.



##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,62 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example Dag demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+import time
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]
+from airflow.sdk import DAG, AsyncCallback, DeadlineAlert, DeadlineReference, 
task
+
+log = logging.getLogger(__name__)
+
+
+async def notify_deadline_missed(**kwargs):
+"""Async callback executed by the Triggerer when the deadline is missed."""
+context = kwargs.get("context", {})
+dag_run = context.get("dag_run")
+log.warning("Deadline missed for dag_run=%s", dag_run)
+
+
+with DAG(
+dag_id="example_deadline_alert",
+description="Demonstrates DeadlineAlert with DAGRUN_QUEUED_AT reference.",
+schedule=None,
+start_date=pendulum.datetime(2025, 1, 1, tz="UTC"),
+catchup=False,
+tags=["example", "deadline"],
+deadline=DeadlineAlert(
+reference=DeadlineReference.DAGRUN_QUEUED_AT,
+interval=timedelta(seconds=30),
+callback=AsyncCallback(notify_deadline_missed),
+name="example_deadline",
+),
+) as dag:
+
+@task
+def hello_deadline():
+log.info("Hello from a Dag with a deadline!")
+# Sleep past the deadline (sync, not a deferred sensor) to keep the 
demo focused on DeadlineAlert.

Review Comment:
   I'm not sure I get what you are trying to convey with the `(sync, not a 
deferred sensor)` part here?  Just pointing out that the wait is synchronous?



-- 
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]



Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-05-11 Thread via GitHub


ferruzzi commented on code in PR #66269:
URL: https://github.com/apache/airflow/pull/66269#discussion_r3222704298


##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example DAG demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]

Review Comment:
   The START and END tags are used as anchors for embedding the surrounded code 
in the rst doc files.



-- 
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]



Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-05-03 Thread via GitHub


parkhojeong commented on code in PR #66269:
URL: https://github.com/apache/airflow/pull/66269#discussion_r3178597364


##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example DAG demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]

Review Comment:
   thanks for your reply! 
   
   i was confused bacause some files don't use `# [START ...` comment in 
exmpale_dags 
   
   here is the files not using `[START...]. 
   - tutorial_taskflow_api_virtualenv.py
   - example_asset_alias_with_no_taskflow.py
   - etc  
   
   but some files are using `[START ...`.
   
   for example_dags, is using `[START ...]` and [END ...] the convention?
   if it is right, I’ll handle the remaining convention updates in a separate 
PR! 



##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example DAG demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]

Review Comment:
   thanks for your reply! 
   
   i was confused bacause some files don't use `# [START ...` comment in 
exmpale_dags 
   
   here is the files not using `[START...]. 
   - tutorial_taskflow_api_virtualenv.py
   - example_asset_alias_with_no_taskflow.py
   - etc  
   
   but some files are using `[START ...`.
   
   for example_dags, is using `[START ...]` and `[END ...]` the convention?
   if it is right, I’ll handle the remaining convention updates in a separate 
PR! 



-- 
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]



Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-05-03 Thread via GitHub


parkhojeong commented on code in PR #66269:
URL: https://github.com/apache/airflow/pull/66269#discussion_r3178597364


##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example DAG demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]

Review Comment:
   thanks for your reply! 
   
   i was confused bacause some files don't use `# [START ...` comment in 
exmpale_dags 
   
   here is the files not using `[START...]. 
   - tutorial_taskflow_api_virtualenv.py
   - example_asset_alias_with_no_taskflow.py
   - etc  
   
   but some files are using `[START ...`.
   
   for example_dags, is using `[START ]` the convention?
   if it is right, I’ll handle the remaining convention updates in a separate 
PR! 



-- 
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]



Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-05-03 Thread via GitHub


jroachgolf84 commented on code in PR #66269:
URL: https://github.com/apache/airflow/pull/66269#discussion_r3178352167


##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example DAG demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]

Review Comment:
   @parkhojeong - please resolve this comment.



-- 
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]



Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-05-03 Thread via GitHub


jroachgolf84 commented on code in PR #66269:
URL: https://github.com/apache/airflow/pull/66269#discussion_r3178351837


##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example DAG demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]

Review Comment:
   Yes, this is the convention. It's used throughout our codebase when building 
documentation.



-- 
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]



Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-05-02 Thread via GitHub


rapsealk commented on code in PR #66269:
URL: https://github.com/apache/airflow/pull/66269#discussion_r3177593707


##
task-sdk/src/airflow/sdk/__init__.pyi:
##
@@ -51,13 +51,21 @@ from airflow.sdk.definitions.asset import (
 )
 from airflow.sdk.definitions.asset.decorators import asset as asset
 from airflow.sdk.definitions.asset.metadata import Metadata as Metadata
+from airflow.sdk.definitions.callback import (
+AsyncCallback as AsyncCallback,
+SyncCallback as SyncCallback,

Review Comment:
   Good catch, thanks! I will look again and leave the patches in soon time.



-- 
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]



Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-05-02 Thread via GitHub


SameerMesiah97 commented on code in PR #66269:
URL: https://github.com/apache/airflow/pull/66269#discussion_r3176847242


##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example DAG demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]
+from airflow.sdk import DAG, AsyncCallback, DeadlineAlert, DeadlineReference, 
task
+
+log = logging.getLogger(__name__)
+
+
+async def notify_deadline_missed(**kwargs):
+"""Async callback executed by the Triggerer when the deadline is missed."""
+context = kwargs.get("context", {})
+dag_run = context.get("dag_run")
+log.warning("Deadline missed for dag_run=%s", dag_run)
+
+
+with DAG(
+dag_id="example_deadline_alert",
+description="Demonstrates DeadlineAlert with DAGRUN_LOGICAL_DATE 
reference.",
+schedule=None,
+start_date=pendulum.datetime(2025, 1, 1, tz="UTC"),
+catchup=False,
+tags=["example", "deadline"],
+deadline=DeadlineAlert(
+reference=DeadlineReference.DAGRUN_LOGICAL_DATE,
+interval=timedelta(hours=1),

Review Comment:
   The interval is far too long for the task. This DAG will almost never 
trigger the DeadlineAlert. Perhaps you could make this 60 seconds and add a 2 
minute wait to the task? You need not do exactly this but my point is the 
running the example DAG should demonstrate the behaviour of the feature in 
question. 



-- 
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]



Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-05-02 Thread via GitHub


parkhojeong commented on code in PR #66269:
URL: https://github.com/apache/airflow/pull/66269#discussion_r3176865928


##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example DAG demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]
+from airflow.sdk import DAG, AsyncCallback, DeadlineAlert, DeadlineReference, 
task
+
+log = logging.getLogger(__name__)
+
+
+async def notify_deadline_missed(**kwargs):
+"""Async callback executed by the Triggerer when the deadline is missed."""
+context = kwargs.get("context", {})
+dag_run = context.get("dag_run")
+log.warning("Deadline missed for dag_run=%s", dag_run)
+
+
+with DAG(
+dag_id="example_deadline_alert",
+description="Demonstrates DeadlineAlert with DAGRUN_LOGICAL_DATE 
reference.",
+schedule=None,
+start_date=pendulum.datetime(2025, 1, 1, tz="UTC"),
+catchup=False,
+tags=["example", "deadline"],
+deadline=DeadlineAlert(
+reference=DeadlineReference.DAGRUN_LOGICAL_DATE,
+interval=timedelta(hours=1),

Review Comment:
   i think so. for test, 1 hour looks so far 



-- 
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]



Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-05-02 Thread via GitHub


parkhojeong commented on code in PR #66269:
URL: https://github.com/apache/airflow/pull/66269#discussion_r3176850384


##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example DAG demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]

Review Comment:
   ```suggestion
   ```
   
   is this convention? if not, it looks better to remove this. 



##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example DAG demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]
+from airflow.sdk import DAG, AsyncCallback, DeadlineAlert, DeadlineReference, 
task
+
+log = logging.getLogger(__name__)
+
+
+async def notify_deadline_missed(**kwargs):
+"""Async callback executed by the Triggerer when the deadline is missed."""
+context = kwargs.get("context", {})
+dag_run = context.get("dag_run")
+log.warning("Deadline missed for dag_run=%s", dag_run)
+
+
+with DAG(
+dag_id="example_deadline_alert",
+description="Demonstrates DeadlineAlert with DAGRUN_LOGICAL_DATE 
reference.",
+schedule=None,
+start_date=pendulum.datetime(2025, 1, 1, tz="UTC"),
+catchup=False,
+tags=["example", "deadline"],
+deadline=DeadlineAlert(
+reference=DeadlineReference.DAGRUN_LOGICAL_DATE,
+interval=timedelta(hours=1),
+callback=AsyncCallback(notify_deadline_missed),
+name="example_deadline",
+),
+) as dag:
+
+@task
+def hello_deadline():
+log.info("Hello from a DAG with a deadline!")

Review Comment:
   ```suggestion
   log.info("Hello from a Dag with a deadline!")
   ```
   
   it is also convention 



##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example DAG demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""

Review Comment:
   ```suggestion
   """Example Dag demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
   ```
   
   can you match the term "Dag" instead of "DAG"



##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distribu

Re: [PR] Add example DAG demonstrating Deadline Alerts [airflow]

2026-05-02 Thread via GitHub


SameerMesiah97 commented on code in PR #66269:
URL: https://github.com/apache/airflow/pull/66269#discussion_r3176826683


##
task-sdk/src/airflow/sdk/__init__.pyi:
##
@@ -51,13 +51,21 @@ from airflow.sdk.definitions.asset import (
 )
 from airflow.sdk.definitions.asset.decorators import asset as asset
 from airflow.sdk.definitions.asset.metadata import Metadata as Metadata
+from airflow.sdk.definitions.callback import (
+AsyncCallback as AsyncCallback,
+SyncCallback as SyncCallback,

Review Comment:
   Why are you importing `SyncCallback` here?  My understanding is that it is 
mid-rollout. Also, you are not using it in your example DAG. 



##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example DAG demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]
+from airflow.sdk import DAG, AsyncCallback, DeadlineAlert, DeadlineReference, 
task
+
+log = logging.getLogger(__name__)
+
+
+async def notify_deadline_missed(**kwargs):
+"""Async callback executed by the Triggerer when the deadline is missed."""
+context = kwargs.get("context", {})
+dag_run = context.get("dag_run")
+log.warning("Deadline missed for dag_run=%s", dag_run)
+
+
+with DAG(
+dag_id="example_deadline_alert",
+description="Demonstrates DeadlineAlert with DAGRUN_LOGICAL_DATE 
reference.",
+schedule=None,
+start_date=pendulum.datetime(2025, 1, 1, tz="UTC"),
+catchup=False,
+tags=["example", "deadline"],
+deadline=DeadlineAlert(
+reference=DeadlineReference.DAGRUN_LOGICAL_DATE,
+interval=timedelta(hours=1),

Review Comment:
   The interval is far too long for the task. This DAG will almost never 
trigger the DeadlineAlert. Perhaps you could make this 60 seconds and add a 2 
minute wait to the task? You need to do exactly this but my point is the 
running the example DAG should demonstrate the behaviour of the feature in 
question. 



##
airflow-core/src/airflow/example_dags/example_deadline_alert.py:
##
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Example DAG demonstrating :class:`~airflow.sdk.DeadlineAlert` usage."""
+
+from __future__ import annotations
+
+import logging
+from datetime import timedelta
+
+import pendulum
+
+# [START example_deadline_alert]
+from airflow.sdk import DAG, AsyncCallback, DeadlineAlert, DeadlineReference, 
task
+
+log = logging.getLogger(__name__)
+
+
+async def notify_deadline_missed(**kwargs):
+"""Async callback executed by the Triggerer when the deadline is missed."""
+context = kwargs.get("context", {})
+dag_run = context.get("dag_run")
+log.warning("Deadline missed for dag_run=%s", dag_run)
+
+
+with DAG(
+dag_id="example_deadline_alert",
+description="Demonstrates DeadlineAlert with DAGRUN_LOGICAL_DATE 
reference.",
+schedule=None,
+start_date=pendulum.datetime(2025, 1, 1, tz="UTC"),
+catchup=False,
+tags=["example", "deadline"],
+deadline=DeadlineAlert(
+reference=DeadlineReference.DAGRUN_LOGICAL_DATE,

Review Comment:
   I am not sure if `DAGRUN_LOGICAL_DATE` is the best reference to use as it 
can result in weird behavior for delayed runs. Have you considered using 
`DAGRUN_QUEUED_AT` instead?



-- 
This i