Skip to content

lit_mlflow.logger

source module lit_mlflow.logger

Classes

  • DbxMLFlowLogger — Initialize an MLflow logger and configure Databricks integration when available.

source class DbxMLFlowLogger(experiment_name: str = 'lightning_logs', run_name: str | None = None, tracking_uri: str | None = mlflow.get_tracking_uri(), tags: dict[str, Any] | None = None, save_dir: str | None = './mlruns', log_model: Literal[True, False, 'all'] = False, prefix: str = '', artifact_location: str | None = None, run_id: str | None = None)

Bases : MLFlowLogger

Initialize an MLflow logger and configure Databricks integration when available.

In Databricks, suppress Py4J gateway logs and propagate notebook credentials before initializing the MLflow client. Outside Databricks, emit a warning.

Parameters

  • experiment_name : str — Name of the MLflow experiment.

  • run_name : str | None — Optional name for the MLflow run.

  • tracking_uri : str | None — URI of the MLflow tracking server.

  • tags : dict[str, Any] | None — Tags to associate with the run.

  • save_dir : str | None — Local directory used when no tracking URI is provided.

  • log_model : Literal[True, False, 'all'] — Whether and when to log model checkpoints.

  • prefix : str — Prefix for logged metric keys.

  • artifact_location : str | None — Location for the experiment's artifacts.

  • run_id : str | None — ID of an existing run to reuse.

Attributes

  • name : Optional[str] — Get the experiment id.

  • version : Optional[str] — Get the run id.

  • root_dir : Optional[str] — Return the root directory where all versions of an experiment get saved, or None if the logger does not save data locally.

  • log_dir : Optional[str] — Return directory the current version of the experiment gets saved, or None if the logger does not save data locally.

  • group_separator : str — Return the default separator used by the logger to group the data into subfolders.

  • save_dir : Optional[str] — The root file directory in which MLflow experiments are saved.

  • experiment : MlflowClient — Get the MLflow client, using the notebook ID as experiment ID when available.

  • run_id : str | None — Get the logger's run ID, preferring the active MLflow run.

  • experiment_id : Optional[str] — Create the experiment if it does not exist to get the experiment id.

source property DbxMLFlowLogger.experiment: MlflowClient

Get the MLflow client, using the notebook ID as experiment ID when available.

Returns

  • MlflowClient — The MLflow client provided by the parent logger.

source property DbxMLFlowLogger.run_id: str | None

Get the logger's run ID, preferring the active MLflow run.

Returns

  • str | None — The active run ID, the logger's existing run ID, or None.