Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve pip requrements infer error handling #5176

Merged
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions mlflow/utils/environment.py
Expand Up @@ -175,7 +175,8 @@ def _is_iterable(x):


_INFER_PIP_REQUIREMENTS_FALLBACK_MESSAGE = (
"Encountered an unexpected error while inferring pip requirements (model URI: %s, flavor: %s)"
"Encountered an unexpected error while inferring pip requirements (model URI: %s, flavor: %s),"
" fallback to generate default pip requirements."
WeichenXu123 marked this conversation as resolved.
Show resolved Hide resolved
)


Expand All @@ -194,7 +195,13 @@ def infer_pip_requirements(model_uri, flavor, fallback=None):
return _infer_requirements(model_uri, flavor)
except Exception:
if fallback is not None:
_logger.exception(_INFER_PIP_REQUIREMENTS_FALLBACK_MESSAGE, model_uri, flavor)
if _logger.level <= logging.DEBUG:
_logger.debug(_INFER_PIP_REQUIREMENTS_FALLBACK_MESSAGE,
model_uri, flavor, exc_info=True)
else:
_logger.warning(_INFER_PIP_REQUIREMENTS_FALLBACK_MESSAGE +
' Set log level to be DEBUG to get more information.',
model_uri, flavor)
WeichenXu123 marked this conversation as resolved.
Show resolved Hide resolved
return fallback
raise

Expand Down