This commit is contained in:
Christian Mantha
2026-03-02 19:10:52 -05:00
commit 2ca0b9ef7c
28907 changed files with 5233713 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import functools
from mlflow.exceptions import MlflowTracingException
def raise_as_trace_exception(f):
"""
A decorator to make sure that the decorated function only raises MlflowTracingException.
Any exceptions are caught and translated to MlflowTracingException before exiting the function.
This is helpful for upstream functions to handle tracing related exceptions properly.
"""
@functools.wraps(f)
def wrapper(*args, **kwargs):
try:
return f(*args, **kwargs)
except Exception as e:
raise MlflowTracingException(e) from e
return wrapper