sam-gen-cop opened a new issue, #46935:
URL: https://github.com/apache/airflow/issues/46935
### Apache Airflow version
Other Airflow 2 version (please specify below)
### If "Other Airflow 2 version" selected, which one?
2.10.1
### What happened?
I have added a custom SLA callback function to the DAG script, which is
supposed to trigger when the task breaches the SLA defined. However, the
callback function is not getting triggered. Please tell me where I'm going
wrong.
### What you think should happen instead?
_No response_
### How to reproduce
Script used to test the callback,
```
import time
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from airflow.utils.log.logging_mixin import LoggingMixin
def sla_miss_callback(dag, task_list, blocking_task_list, slas,
blocking_tis):
logger = LoggingMixin().log
logger.info("SLA MISS CALLBACK TRIGGERED!")
logger.info(f"Dag: {dag.dag_id}")
logger.info(f"Task List: {task_list}")
logger.info(f"Blocking Task List: {blocking_task_list}")
logger.info(f"SLAs: {slas}")
logger.info(f"Blocking TIs: {blocking_tis}")
def sleep_task():
time.sleep(15)
default_args = {
'owner': 'airflow',
'start_date': datetime(2025, 1, 1),
}
with DAG(
dag_id='test_sla_callback',
default_args=default_args,
schedule_interval="*/5 * * * *",
sla_miss_callback=sla_miss_callback,
catchup=False
) as dag:
sleeper = PythonOperator(
task_id='sleep_long_time',
python_callable=sleep_task,
sla=timedelta(seconds=10),
)
```
### Operating System
NA
### Versions of Apache Airflow Providers
apache-airflow-providers-amazon - 8.28.0
apache-airflow-providers-celery - 3.8.1
apache-airflow-providers-common-compat - 1.2.0
apache-airflow-providers-common-io - 1.4.0
apache-airflow-providers-common-sql - 1.16.0
apache-airflow-providers-fab - 1.3.0
apache-airflow-providers-ftp - 3.11.0
apache-airflow-providers-http - 4.13.0
apache-airflow-providers-imap - 3.7.0
apache-airflow-providers-postgres - 5.12.0
apache-airflow-providers-smtp - 1.8.0
apache-airflow-providers-sqlite - 3.9.0
### Deployment
Amazon (AWS) MWAA
### Deployment details
_No response_
### Anything else?
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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]