Skip to main content

@timeout

The @timeout decorator specifies for how long a step should execute before it is interrupted.

You can use it to handle tasks that may get stuck, or to set a time-budget for a step. For more information, see Dealing with Failures.

@timeout(...)

[source]

from metaflow import timeout

Specifies a timeout for your step.

This decorator is useful if this step may hang indefinitely.

This can be used in conjunction with the @retry decorator as well as the @catch decorator. A timeout is considered to be an exception thrown by the step. It will cause the step to be retried if needed and the exception will be caught by the @catch decorator, if present.

Note that all the values specified in parameters are added together so if you specify 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.

Parameters 

seconds: int, default 0

Number of seconds to wait prior to timing out.

minutes: int, default 0

Number of minutes to wait prior to timing out.

hours: int, default 0

Number of hours to wait prior to timing out.