@catch
The @catch
decorator ensures that a step will succeed, despite any errors in the user code or transient platform issues.
It is best used in conjunction with the @retry
decorator: After all retries have been exhausted, @catch
executes a no-op task that allows the run to continue. For more information, see Dealing with Failures.
from metaflow import catch
Specifies that the step will success under all circumstances.
The decorator will create an optional artifact, specified by var
, which
contains the exception raised. You can use it to detect the presence
of errors, indicating that all happy-path artifacts produced by the step
are missing.
var: str, optional, default None
Name of the artifact in which to store the caught exception. If not specified, the exception is not stored.
print_exception: bool, default True
Determines whether or not the exception is printed to stdout when caught.