This is an automated email from the ASF dual-hosted git repository.
amoghdesai pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 9cd9c9f9f77 Add back Deprecation warning for sla_miss_callback (#56127)
9cd9c9f9f77 is described below
commit 9cd9c9f9f770bc21c3b0895fd67e8f735b2d5902
Author: Kaxil Naik <[email protected]>
AuthorDate: Fri Sep 26 08:45:29 2025 +0100
Add back Deprecation warning for sla_miss_callback (#56127)
This was removed in #50093 -- I assume by mistake! Adding this back to not
break das of people migration from Airflow 2.x
---
task-sdk/src/airflow/sdk/bases/operator.py | 2 +-
task-sdk/src/airflow/sdk/definitions/dag.py | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/task-sdk/src/airflow/sdk/bases/operator.py
b/task-sdk/src/airflow/sdk/bases/operator.py
index 2cc891d106b..a11b5894b0d 100644
--- a/task-sdk/src/airflow/sdk/bases/operator.py
+++ b/task-sdk/src/airflow/sdk/bases/operator.py
@@ -1108,7 +1108,7 @@ class BaseOperator(AbstractOperator,
metaclass=BaseOperatorMeta):
raise ValueError(f"pool slots for {self.task_id}{dag_str} cannot
be less than 1")
if sla is not None:
warnings.warn(
- "The SLA feature is removed in Airflow 3.0, to be replaced
with a new implementation in >=3.1",
+ "The SLA feature is removed in Airflow 3.0, replaced with
Deadline Alerts in >=3.1",
stacklevel=2,
)
diff --git a/task-sdk/src/airflow/sdk/definitions/dag.py
b/task-sdk/src/airflow/sdk/definitions/dag.py
index 5c4b139eb75..4a5f9bd92f1 100644
--- a/task-sdk/src/airflow/sdk/definitions/dag.py
+++ b/task-sdk/src/airflow/sdk/definitions/dag.py
@@ -460,6 +460,7 @@ class DAG:
),
)
+ sla_miss_callback: None = attrs.field(default=None)
catchup: bool = attrs.field(
factory=_config_bool_factory("scheduler", "catchup_by_default"),
)
@@ -614,6 +615,15 @@ class DAG:
def _has_on_failure_callback(self) -> bool:
return self.on_failure_callback is not None
+ @sla_miss_callback.validator
+ def _validate_sla_miss_callback(self, _, value):
+ if value is not None:
+ warnings.warn(
+ "The SLA feature is removed in Airflow 3.0, and replaced with
a Deadline Alerts in >=3.1",
+ stacklevel=2,
+ )
+ return value
+
def __repr__(self):
return f"<DAG: {self.dag_id}>"