Skip to content

chuchichaestli.programs.trackers.mlflow

Logging a run to MLflow.

Classes:

Name Description
MLflow

Log a run to MLflow, through an explicit client rather than the active run.

MLflow

MLflow(
    tracking_uri: str | None = None,
    artifact_location: str | None = None,
    tags: Mapping[str, str] | None = None,
    log: TrackingPolicy | PresetTypes = "default",
    config: Mapping[str, Any] | None = None,
    **options: Any,
)

Bases: Tracker

Log a run to MLflow, through an explicit client rather than the active run.

Constructor.

Parameters:

Name Type Description Default
tracking_uri str | None

Where runs are tracked; MLFLOW_TRACKING_URI, or a SQLite database in the run's store, when absent. Any scheme a store plugin serves works.

None
artifact_location str | None

Where a new experiment keeps its files; the store's mlartifacts directory with the default database.

None
tags Mapping[str, str] | None

Tags every run gets, beside project and those MLflow's run context providers add.

None
log TrackingPolicy | PresetTypes

What to log, as for Tracker.

'default'
config Mapping[str, Any] | None

Your own configuration, as for Tracker.

None
options Any

TrackingPolicy fields changed on top of log.

{}
Source code in src/chuchichaestli/programs/trackers/mlflow.py
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
def __init__(
    self,
    tracking_uri: str | None = None,
    artifact_location: str | None = None,
    tags: Mapping[str, str] | None = None,
    log: TrackingPolicy | PresetTypes = "default",
    config: Mapping[str, Any] | None = None,
    **options: Any,
):
    """Constructor.

    Args:
        tracking_uri: Where runs are tracked; `MLFLOW_TRACKING_URI`, or a
            SQLite database in the run's store, when absent. Any scheme a
            store plugin serves works.
        artifact_location: Where a new experiment keeps its files; the
            store's `mlartifacts` directory with the default database.
        tags: Tags every run gets, beside `project` and those MLflow's
            run context providers add.
        log: What to log, as for `Tracker`.
        config: Your own configuration, as for `Tracker`.
        options: `TrackingPolicy` fields changed on top of `log`.
    """
    super().__init__(log=log, config=config, **options)
    self.tracking_uri = tracking_uri or os.environ.get("MLFLOW_TRACKING_URI")
    self.artifact_location = artifact_location
    self.tags = dict(tags or {})
    self.needs_store = self.tracking_uri is None
    self._entities: Any = None
    self._client: Any = None
    self._buffered: list[Any] = []
    self._flushed = 0.0