Skip to content

Commit

Permalink
Merge pull request #168 from y0z/feature/fix-ci
Browse files Browse the repository at this point in the history
Fix mlflow integration for CI
  • Loading branch information
nabenabe0928 authored Oct 18, 2024
2 parents 403d8e8 + 9258f2b commit a16da7d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion optuna_integration/mlflow/mlflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def wrapper(trial: optuna.trial.Trial) -> float | Sequence[float]:
with self._lock:
study = trial.study
self._initialize_experiment(study)
nested = self._mlflow_kwargs.get("nested")
nested = bool(self._mlflow_kwargs.get("nested"))
run_name = self._mlflow_kwargs.get("run_name", str(trial.number))

with mlflow.start_run(run_name=run_name, nested=nested) as run:
Expand Down
5 changes: 3 additions & 2 deletions tests/mlflow/test_mlflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ def test_use_existing_experiment_by_id(tmpdir: py.path.local) -> None:
assert experiment.experiment_id == experiment_id
assert experiment.name == "foo"

runs = mlfl_client.search_runs(experiment_id)
# TODO(y0z): Remove type ignore once the MLFlow typing is fixed.
runs = mlfl_client.search_runs(experiment_id) # type: ignore
assert len(runs) == 10


Expand Down Expand Up @@ -235,7 +236,7 @@ def test_tag_truncation(tmpdir: py.path.local) -> None:
first_run_dict = first_run.to_dictionary()

my_user_attr = first_run_dict["data"]["tags"]["my_user_attr"]
assert len(my_user_attr) <= 5000
assert len(my_user_attr) <= 8000


def test_nest_trials(tmpdir: py.path.local) -> None:
Expand Down

0 comments on commit a16da7d

Please sign in to comment.