SIENTIAPDE-1646
Refactor MLflow configuration to use environment variable for tracking URL - Removed the `_build_mlflow_tracking_url` function and replaced its usage with `getenv` to directly retrieve the `MLFLOW_URL` environment variable. - This change simplifies the configuration process by allowing users to specify the tracking URL directly through an environment variable.
This commit is contained in:
@@ -3,26 +3,6 @@ from os import getenv
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
def _build_mlflow_tracking_url() -> str:
|
|
||||||
"""
|
|
||||||
Compose a single tracking URI for ``SientiaMLflowRepository`` from host and port env vars.
|
|
||||||
|
|
||||||
If ``MLFLOW_HOST`` already contains a port in the authority (e.g. ``http://tracker:80``),
|
|
||||||
it is returned unchanged so operators can override port logic explicitly.
|
|
||||||
|
|
||||||
Return:
|
|
||||||
str: Full tracking URL (scheme + host [+ port]).
|
|
||||||
"""
|
|
||||||
|
|
||||||
mlflow_host = getenv('MLFLOW_HOST', 'http://localhost').rstrip('/')
|
|
||||||
mlflow_port = getenv('MLFLOW_PORT', '5080')
|
|
||||||
|
|
||||||
# Host already includes an explicit port (e.g. http://tracker:80)
|
|
||||||
host_after_scheme = mlflow_host.split('://', 1)[-1]
|
|
||||||
if ':' in host_after_scheme:
|
|
||||||
return mlflow_host
|
|
||||||
|
|
||||||
return f'{mlflow_host}:{mlflow_port}'
|
|
||||||
|
|
||||||
|
|
||||||
def build_mlflow_config() -> dict[str, Any]:
|
def build_mlflow_config() -> dict[str, Any]:
|
||||||
@@ -42,7 +22,7 @@ def build_mlflow_config() -> dict[str, Any]:
|
|||||||
dict[str, Any]: ``url``, ``username``, ``password``.
|
dict[str, Any]: ``url``, ``username``, ``password``.
|
||||||
"""
|
"""
|
||||||
return {
|
return {
|
||||||
'url': _build_mlflow_tracking_url(),
|
'url': getenv('MLFLOW_URL', 'http://localhost:5080'),
|
||||||
'username': getenv('MLFLOW_USERNAME', 'aignosi'),
|
'username': getenv('MLFLOW_USERNAME', 'aignosi'),
|
||||||
'password': getenv('MLFLOW_PASSWORD', 'aignosi'),
|
'password': getenv('MLFLOW_PASSWORD', 'aignosi'),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user