bronzels opened a new issue, #38931:
URL: https://github.com/apache/airflow/issues/38931

   ### Apache Airflow version
   
   2.9.0
   
   ### If "Other Airflow 2 version" selected, which one?
   
   2.8.4
   
   ### What happened?
   
   Just as MathematicalOwl told in at the end of a stackoverflow post:
   
https://stackoverflow.com/questions/59959290/airflow-sla-miss-callback-function-not-triggering
   Unlike the on_failure_callback that is looking for a python callable 
function, it appears that sla_miss_callback needs the full function call.  Only 
below way it can work, then no context except dag_id.
   `
   def on_sla_miss_callback(dag):
       continue
   dag_id="my_example_alert"
   with DAG(
       dag_id=dag_id,
       sla_miss_callback=on_sla_miss_callback(dag_id),
   
   this_will_skip = BashOperator(
       task_id="this_will_skip",
       #bash_command='echo "hello world"; exit 99;',
       bash_command='echo "hello world"; sleep 40;',
       #execution_timeout=timedelta(seconds=3),
       sla=timedelta(seconds=32),
       dag=dag,
   )
   
   `
   
   ### What you think should happen instead?
   
   _No response_
   
   ### How to reproduce
   
   Just as described in "what happended", define a sla_miss_callback, only take 
dag_id as input, then give the callback to DAG as construction input by 
sla_miss_callback=sla_miss_callback(dag_id). Add a operator with sla little 
than the execution duration. Then the callback is triggered. But if define the 
callback like these, all not working:
   `
   #def on_sla_miss_callback(dag, task_list, blocking_task_list, slas, 
blocking_tis, *args, **kwargs):
   #def on_sla_miss_callback(dag, task_list, blocking_task_list, slas, 
blocking_tis):
   #def on_sla_miss_callback(*args, **kwargs):
   def on_sla_miss_callback(dag):
   
   `
   
   ### Operating System
   
   centos 7
   
   ### Versions of Apache Airflow Providers
   
   no providers are used in this example
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   Both 2.9.0/2.8.4 manual deployment on centos cluster. And also a K8S cluster 
by official helm and docker image.
   
   ### 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: commits-unsubscr...@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to