Airflow : Is it possible to configure task-level timeout in a DAG?

Viewed 671

Airflow : Is it possible to configure task-level timeout in a DAG .

I wished to prevent a task from running indefinitely . According to my understanding sla parameters will come in place only once the task gets completed and overshoots the SLA .

1 Answers

For timeouts on Operators in Airflow you can add the execution_timeout parameter. From the docs:

exuction_timeout (datetime.timedelta) – max time allowed for the execution of this task instance, if it goes beyond it will raise and fail

It expects a datetime.timedelta, e.g. timedelta(hours=1) for a max of 1 hour for the task.

Note that for sensors execution_timeout does not work. Sensors expect a timeout parameter instead.

Related