From 16ea436e4535d3c38966a9aa829050a75b2adf6a Mon Sep 17 00:00:00 2001 From: vitor-aignosi Date: Mon, 11 May 2026 13:28:37 -0300 Subject: [PATCH] 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. --- laborious/utils/connectors_config.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/laborious/utils/connectors_config.py b/laborious/utils/connectors_config.py index 467c8e2..029f427 100644 --- a/laborious/utils/connectors_config.py +++ b/laborious/utils/connectors_config.py @@ -3,26 +3,6 @@ from os import getenv 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]: @@ -42,7 +22,7 @@ def build_mlflow_config() -> dict[str, Any]: dict[str, Any]: ``url``, ``username``, ``password``. """ return { - 'url': _build_mlflow_tracking_url(), + 'url': getenv('MLFLOW_URL', 'http://localhost:5080'), 'username': getenv('MLFLOW_USERNAME', 'aignosi'), 'password': getenv('MLFLOW_PASSWORD', 'aignosi'), }