Skip to content

Commit

Permalink
fix (data): Fix symlink from metadata to experiment file.
Browse files Browse the repository at this point in the history
Bug existed because we were attempting to trim ".html", but ended up trimming
"debug"

Also:
    Fix bug resolving trials_folder when using default value with no
        pyproject.toml config
  • Loading branch information
Jacob-Stevens-Haas committed Apr 27, 2024
1 parent 5ab65dc commit 8785ed4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mitosis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def _create_filename(
new_filename = f"trial_{variant}_{iteration}_{suffix}"
if debug:
new_filename += "debug"
elif extension == "html":
if extension == "html":
new_filename += ".html"
elif extension == "ipynb":
new_filename += ".ipynb"
Expand Down
4 changes: 2 additions & 2 deletions mitosis/_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def locate_trial_folder(
trials_folder = Path("trials")
else:
trials_folder = Path(trials_folder).resolve()
if not trials_folder.absolute():
trials_folder = get_repo().working_dir.absolute() / trials_folder
if not trials_folder.is_absolute():
trials_folder = Path(get_repo().working_dir).absolute() / trials_folder
if not hexstr:
return trials_folder

Expand Down
2 changes: 2 additions & 0 deletions mitosis/tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ def test_mock_experiment(mock_steps, tmp_path):
)
data = mitosis.load_trial_data(exp_key, trials_folder=tmp_path)
assert len(data[1]["data"]) == 5
metadata = mitosis._disk.locate_trial_folder(exp_key, trials_folder=tmp_path)
assert (metadata / "experiment").resolve().exists()


def test_mod_metadata_debug(mock_steps, tmp_path):
Expand Down

0 comments on commit 8785ed4

Please sign in to comment.