My DAG is scheduled to run daily at 7 AM. Can I specify time of the day to execution timeout parameter instead of duration.
For example, I want to add specific time 12 PM so that job will fail if it is still running at 12 PM.
My DAG is scheduled to run daily at 7 AM. Can I specify time of the day to execution timeout parameter instead of duration.
For example, I want to add specific time 12 PM so that job will fail if it is still running at 12 PM.
Such a param is not present in BaseOperator
or DAG
You'll have a build it. Here's some hint how you can go about it (not certain if this would work)
TimeSensor
(not to be confused with TimeDeltaSensor
) by subclassing it, that kills the DAG upon failure.
execute()
method_mark_dagrun_state_as_failed()
methoddatetime
timeout, add that custom sensor task as one of the starting tasks (tasks that don't have an upstream task) of you DAG
In case you have to timeout some specific task(s) instead of entire DAG
_mark_task_instance_state()
method for it