Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
⚰️ Remove references to old submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhessey committed Jun 23, 2022
1 parent 32e5649 commit 26274bf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 23 deletions.
15 changes: 2 additions & 13 deletions InnerEye/Common/fixed_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
import sys
from pathlib import Path
from typing import List, Optional, Tuple
from typing import Optional

from InnerEye.Common.type_annotations import PathOrString

Expand Down Expand Up @@ -104,15 +104,6 @@ def get_environment_yaml_file() -> Path:
return env


def get_hi_ml_submodule_relative_paths() -> List[Tuple[Path, str]]:
"""
Returns the paths relative to the repository root where the submodules for hi-ml and hi-ml-azure are expected.
It returns a list with a tuple (folder name, expected subfolder in that folder)
"""
return [(Path("hi-ml") / "hi-ml-azure" / "src", "health_azure"),
(Path("hi-ml") / "hi-ml" / "src", "health_ml")]


def add_submodules_to_path() -> None:
"""
This function adds all submodules that the code uses to sys.path and to the environment variables. This is
Expand All @@ -123,9 +114,7 @@ def add_submodules_to_path() -> None:
up in sys.path.
"""
innereye_root = repository_root_directory()
folders_to_add = [(innereye_root, "InnerEye"),
(innereye_root / "fastMRI", "fastmri")]
folders_to_add.extend([(innereye_root / p, folder) for p, folder in get_hi_ml_submodule_relative_paths()])
folders_to_add = [(innereye_root, "InnerEye")]
for (folder, subfolder_that_must_exist) in folders_to_add:
if (folder / subfolder_that_must_exist).is_dir():
folder_str = str(folder)
Expand Down
6 changes: 1 addition & 5 deletions InnerEye/ML/run_ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,11 +654,7 @@ def copy_file(source: Path, destination_file: str) -> None:
# we can identify it by going up the folder structure off a known file (repository_root does exactly that)
repository_root = fixed_paths.repository_root_directory()
copy_folder(repository_root / INNEREYE_PACKAGE_NAME)
# If hi-ml is used as a submodule, copy that too
for relative_path, _ in fixed_paths.get_hi_ml_submodule_relative_paths():
full_submodule_path = repository_root / relative_path
if full_submodule_path.is_dir():
copy_folder(full_submodule_path, relative_path)

# Extra code directory is expected to be relative to the project root folder.
if self.azure_config.extra_code_directory:
extra_code_folder = self.project_root / self.azure_config.extra_code_directory
Expand Down
6 changes: 1 addition & 5 deletions TestsOutsidePackage/test_register_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ def test_copy_child_paths_to_folder(is_ensemble: bool,
project_root = Path(__file__).parent.parent
ml_runner = MLRunner(model_config=fake_model, azure_config=azure_config, project_root=project_root)
model_folder = test_output_dirs.root_dir / "final"
hi_ml_submodules = [p for p, _ in fixed_paths.get_hi_ml_submodule_relative_paths()]
has_submodule = any(folder.is_dir() for folder in hi_ml_submodules)
ml_runner.copy_child_paths_to_folder(model_folder=model_folder, checkpoint_paths=checkpoints_absolute)
expected_files = [
fixed_paths.ENVIRONMENT_YAML_FILE_NAME,
Expand All @@ -63,9 +61,7 @@ def test_copy_child_paths_to_folder(is_ensemble: bool,
"InnerEye/Common/fixed_paths.py",
"InnerEye/Common/common_util.py",
]
if has_submodule:
expected_files.extend(["hi-ml/hi-ml/src/health_ml/__init__.py",
"hi-ml/hi-ml-azure/src/health_azure/__init__.py"])

for r in checkpoints_relative:
expected_files.append(f"{CHECKPOINT_FOLDER}/{r}")
for expected_file in expected_files:
Expand Down

0 comments on commit 26274bf

Please sign in to comment.