notatallshaw-work opened a new issue, #26566:
URL: https://github.com/apache/airflow/issues/26566

   ### What do you see as an issue?
   
   The [SLA 
documentation](https://airflow.apache.org/docs/apache-airflow/stable/concepts/tasks.html#slas)
 currently states the following:
   
   > An SLA, or a Service Level Agreement, is an expectation for the maximum 
time a Task should take. If a task takes longer than this to run
   
   However this is not how SLAs currently work in Airflow, the SLA time is 
calculated from the start of the DAG not from the start of the task.
   
   For example if you have a DAG like this the SLA will always trigger after 
the DAG has started for 5 minutes even though the task never takes 5 minutes to 
run:
   
   ```python
   import datetime
   
   from airflow import DAG
   from airflow.sensors.time_sensor import TimeSensor
   from airflow.operators.python import PythonOperator
   
   
   with DAG(dag_id="my_dag", schedule_interval="0 0 * * *") as dag:
       wait_time_mins = TimeSensor(target_time=datetime.time(minute=10))
       run_fast = PythonOperator(
           python_callable=lambda *a, **kwargs: True,
           sla=datetime.timedelta(minutes=5),
       )
       run_fast.set_upstream(wait_time_mins)
   ```
   
   
   ### Solving the problem
   
   Update the docs to explain how SLAs work in reality.
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] 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]

Reply via email to