hkarakaki opened a new issue #16389: URL: https://github.com/apache/airflow/issues/16389
**Apache Airflow version**: 2.1.0 **Kubernetes version (if you are using kubernetes)** (use `kubectl version`): NA **Environment**: - **Cloud provider or hardware configuration**: AWS - **OS** (e.g. from /etc/os-release): Ubuntu 18.04.5 - **Kernel** (e.g. `uname -a`): Linux ip-172-20-1-237 5.4.0-1049-aws #51~18.04.1-Ubuntu SMP Fri May 14 18:38:46 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux - **Install tools**: - **Others**: **What happened**: We migrated from 1.10.15 this week, and noticed SLA misses are not being reported in UI and callback isn't triggered. Usually we have some checkpoint task in our largest DAGs and the SLA is defined only for that task, the task also helps us set up cross-DAG dependencies. **What you expected to happen**: SLA misses are registered in UI and trigger the callback. **What do you think went wrong?** I think tasks without SLA should be excluded from the loop here: https://github.com/apache/airflow/blob/304e174674ff6921cb7ed79c0158949b50eff8fe/airflow/jobs/scheduler_job.py#L411-L438 **How to reproduce it**: With this DAG you can check that the SLA is not detected. ```Python from datetime import datetime, timedelta from airflow import DAG from airflow.operators.bash_operator import BashOperator with DAG( dag_id="sla_trigger", schedule_interval="*/5 * * * *", start_date=datetime(2021, 6, 10), ) as dag: BashOperator( task_id="bash_task", bash_command="sleep 30", sla=timedelta(seconds=2), ) BashOperator( task_id="bash_task_2", bash_command="sleep 30", ) ``` But to get the error mentioned below, you need to add a callback function. **Anything else we need to know**: This error happens every time for every DAG that has SLA on some tasks, and the same DAG definition worked fine in v1.10.15. <details><summary>Scheduler's log</summary> We've seen this error in the scheduler for all the DAGs:<br> [2021-06-09 20:30:57,679] {scheduler_job.py:396} INFO - Running SLA Checks for company_dag<br> [2021-06-09 20:30:57,763] {scheduler_job.py:569} ERROR - Error executing SlaCallbackRequest callback for file: /opt/airflow/tasks/airflow_dags/eu-central-1/company_dag.py<br> Traceback (most recent call last):<br> File "/usr/local/lib/python3.8/dist-packages/airflow/jobs/scheduler_job.py", line 565, in execute_callbacks<br> self.manage_slas(dagbag.dags.get(request.dag_id)) <br> File "/usr/local/lib/python3.8/dist-packages/airflow/utils/session.py", line 70, in wrapper<br> return func(*args, session=session, **kwargs) <br> File "/usr/local/lib/python3.8/dist-packages/airflow/jobs/scheduler_job.py", line 433, in manage_slas<br> if following_schedule + task.sla < timezone.utcnow():<br> TypeError: unsupported operand type(s) for +: 'datetime.datetime' and 'NoneType'<br> </details> -- 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. For queries about this service, please contact Infrastructure at: [email protected]
