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,31 @@
"""
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."
)