Skip to content

Commit

Permalink
Merge pull request #269 from NVIDIA/am/the-only-verify
Browse files Browse the repository at this point in the history
Remove deprecated verify modes
  • Loading branch information
amaslenn authored Oct 17, 2024
2 parents e3f4d92 + 602c8c2 commit 284c6a8
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 104 deletions.
4 changes: 0 additions & 4 deletions src/cloudai/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
handle_dry_run_and_run,
handle_generate_report,
handle_install_and_uninstall,
handle_verify_systems,
handle_verify_tests,
identify_unique_test_templates,
)

Expand Down Expand Up @@ -78,8 +76,6 @@ def setup_logging(log_file: str, log_level: str) -> None:
"handle_dry_run_and_run",
"handle_generate_report",
"handle_install_and_uninstall",
"handle_verify_systems",
"handle_verify_tests",
"identify_unique_test_templates",
"setup_logging",
]
30 changes: 0 additions & 30 deletions src/cloudai/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
handle_generate_report,
handle_install_and_uninstall,
handle_verify_all_configs,
handle_verify_systems,
handle_verify_test_scenarios,
handle_verify_tests,
)


Expand All @@ -39,9 +36,6 @@ def __init__(self):
"install",
"run",
"uninstall",
"verify-systems",
"verify-tests",
"verify-test-scenarios",
"verify-configs",
}

Expand Down Expand Up @@ -101,30 +95,6 @@ def init_default_args(self) -> argparse.ArgumentParser:
output_dir=True,
)

if "verify-systems" in self.DEFAULT_MODES:
p = self.add_command(
"verify-systems",
"[DEPRECATED: use verify-configs] Verify the system configurations.",
handle_verify_systems,
)
p.add_argument("system_configs", help="Path to the system configuration file or directory.", type=Path)

if "verify-tests" in self.DEFAULT_MODES:
p = self.add_command(
"verify-tests", "[DEPRECATED: use verify-configs] Verify the test configurations.", handle_verify_tests
)
p.add_argument("test_configs", help="Path to the test configuration file or directory.", type=Path)

if "verify-test-scenarios" in self.DEFAULT_MODES:
p = self.add_command(
"verify-test-scenarios",
"[DEPRECATED: use verify-configs] Verify the test scenario configurations.",
handle_verify_test_scenarios,
system_config=False,
tests_dir=True,
)
p.add_argument("test_scenarios", help="Path to the test scenario file or directory.", type=Path)

if "verify-configs" in self.DEFAULT_MODES:
p = self.add_command(
"verify-configs",
Expand Down
27 changes: 0 additions & 27 deletions src/cloudai/cli/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,6 @@ def expand_file_list(root: Path, glob: str = "*.toml") -> tuple[int, List[Path]]
return (0, test_tomls)


def handle_verify_systems(args: argparse.Namespace) -> int:
root: Path = args.system_configs
err, system_tomls = expand_file_list(root)
if err:
return err

return verify_system_configs(system_tomls)


def verify_system_configs(system_tomls: List[Path]) -> int:
nfailed = 0
for test_toml in system_tomls:
Expand All @@ -224,15 +215,6 @@ def verify_system_configs(system_tomls: List[Path]) -> int:
return nfailed


def handle_verify_tests(args: argparse.Namespace) -> int:
root: Path = args.test_configs
err, test_tomls = expand_file_list(root)
if err:
return err

return verify_test_configs(test_tomls)


def verify_test_configs(test_tomls: List[Path]) -> int:
nfailed = 0
for test_toml in test_tomls:
Expand All @@ -250,15 +232,6 @@ def verify_test_configs(test_tomls: List[Path]) -> int:
return nfailed


def handle_verify_test_scenarios(args: argparse.Namespace) -> int:
root: Path = args.test_scenarios
err, test_tomls = expand_file_list(root)
if err:
return err

return verify_test_scenarios(test_tomls, list(args.tests_dir.glob("*.toml")), args.system_config)


def verify_test_scenarios(
scenario_tomls: List[Path], test_tomls: list[Path], system_config: Optional[Path] = None
) -> int:
Expand Down
44 changes: 1 addition & 43 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
CloudAICLI,
handle_generate_report,
handle_install_and_uninstall,
handle_verify_systems,
handle_verify_tests,
)
from cloudai.cli.handlers import handle_verify_all_configs, handle_verify_test_scenarios
from cloudai.cli.handlers import handle_verify_all_configs


def test_help_message(capsys: pytest.CaptureFixture[str]) -> None:
Expand Down Expand Up @@ -221,46 +219,6 @@ def test_install_uninstall_modes(self, cli: CloudAICLI):
output_dir=None,
)

def test_verify_systems_mode(self, cli: CloudAICLI):
assert "verify-systems" in cli.handlers
assert cli.handlers["verify-systems"] is handle_verify_systems

args = cli.parser.parse_args(["verify-systems", "system_config"])
assert args == argparse.Namespace(
log_file="debug.log",
log_level="INFO",
mode="verify-systems",
**{"system_configs": Path("system_config")},
)

def test_verify_tests_mode(self, cli: CloudAICLI):
assert "verify-tests" in cli.handlers
assert cli.handlers["verify-tests"] is handle_verify_tests

args = cli.parser.parse_args(["verify-tests", "test_configs"])
assert args == argparse.Namespace(
log_file="debug.log",
log_level="INFO",
mode="verify-tests",
**{"test_configs": Path("test_configs")},
)

def test_verify_test_scenarios_mode(self, cli: CloudAICLI):
assert "verify-test-scenarios" in cli.handlers
assert cli.handlers["verify-test-scenarios"] is handle_verify_test_scenarios

args = cli.parser.parse_args(
["verify-test-scenarios", "--system-config", "system_config", "--tests-dir", "tests_dir", "test_scenarios"]
)
assert args == argparse.Namespace(
log_file="debug.log",
log_level="INFO",
mode="verify-test-scenarios",
system_config=Path("system_config"),
tests_dir=Path("tests_dir"),
**{"test_scenarios": Path("test_scenarios")},
)

def test_verify_all_configs_mode(self, cli: CloudAICLI):
assert "verify-configs" in cli.handlers
assert cli.handlers["verify-configs"] is handle_verify_all_configs
Expand Down

0 comments on commit 284c6a8

Please sign in to comment.