Skip to content

Commit

Permalink
Improve pip requrements infer error handling (#5176)
Browse files Browse the repository at this point in the history
* init

Signed-off-by: Weichen Xu <weichen.xu@databricks.com>

* update

Signed-off-by: Weichen Xu <weichen.xu@databricks.com>

* update

Signed-off-by: Weichen Xu <weichen.xu@databricks.com>

* update

Signed-off-by: Weichen Xu <weichen.xu@databricks.com>

* update

Signed-off-by: Weichen Xu <weichen.xu@databricks.com>

* Autoformat: https://github.com/mlflow/mlflow/actions/runs/1587443466

Signed-off-by: mlflow-automation <mlflow-automation@users.noreply.github.com>

Co-authored-by: mlflow-automation <mlflow-automation@users.noreply.github.com>
  • Loading branch information
WeichenXu123 and mlflow-automation committed Dec 17, 2021
1 parent 044ad9e commit a68de12
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 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),"
" fall back to return %s. Set logging level to DEBUG to see the full traceback."
)


Expand All @@ -194,7 +195,8 @@ 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)
_logger.warning(_INFER_PIP_REQUIREMENTS_FALLBACK_MESSAGE, model_uri, flavor, fallback)
_logger.debug("", exc_info=True)
return fallback
raise

Expand Down

0 comments on commit a68de12

Please sign in to comment.