Files
zenml/venv/lib/python3.9/site-packages/mlflow/deployments/server/app.py
Christian Mantha 2ca0b9ef7c star
2026-03-02 19:10:52 -05:00

32 lines
987 B
Python

"""
TODO: Remove this module once after Deployments Server deprecation window elapses
"""
from mlflow.environment_variables import (
MLFLOW_DEPLOYMENTS_CONFIG,
)
from mlflow.exceptions import MlflowException
from mlflow.gateway.app import GatewayAPI
from mlflow.gateway.app import (
create_app_from_config as gateway_create_app_from_config,
)
from mlflow.gateway.app import (
create_app_from_path as gateway_create_app_from_path,
)
create_app_from_config = gateway_create_app_from_config
create_app_from_path = gateway_create_app_from_path
def create_app_from_env() -> GatewayAPI:
"""
Load the path from the environment variable and generate the GatewayAPI app instance.
"""
if config_path := MLFLOW_DEPLOYMENTS_CONFIG.get():
return create_app_from_path(config_path)
raise MlflowException(
f"Environment variable {MLFLOW_DEPLOYMENTS_CONFIG!r} is not set. "
"Please set it to the path of the gateway configuration file."
)