gunz_ml.utils package
- gunz_ml.utils.check_mlflow_connection(tracking_uri: str, timeout: int = 5) bool[source]
Wrapper to check MLflow connection from a raw URI.
- gunz_ml.utils.check_optuna_connection(storage_url: str, timeout: int = 5) bool[source]
Wrapper to check Optuna connection from a raw URI.
Submodules
gunz_ml.utils.connectivity module
- gunz_ml.utils.connectivity.build_db_uri(cfg: DatabaseConfig | dict) str[source]
Constructs a database URI from a configuration object or dictionary.
- Parameters:
cfg (Union[DatabaseConfig, dict]) – The configuration object or dictionary containing database connection details. Expected keys/attributes: driver, user, password, host, port, db_name.
- Returns:
A formatted SQLAlchemy or HTTP URI string.
- Return type:
- Raises:
ValueError – If the database driver is not specified in the config.
- gunz_ml.utils.connectivity.check_db_connection(cfg: DatabaseConfig | dict, timeout: int = 5) bool[source]
Verifies connectivity to the database tracker (MLflow or Optuna).
- Parameters:
cfg (Union[DatabaseConfig, dict]) – The configuration object or dictionary containing connection details.
timeout (int, optional) – The connection timeout in seconds, by default 5.
- Returns:
True if the connection was successfully established, False otherwise.
- Return type: