diff --git a/README.md b/README.md index 83c964e1..2b4d6024 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ cloudai\ --mode install\ --system-config conf/common/system/example_slurm_cluster.toml\ --test-templates-dir conf/common/test_template\ - --tests-dir conf/common/tests + --tests-dir conf/common/test ``` To simulate running experiments without execution, use the dry-run mode: @@ -79,7 +79,7 @@ cloudai\ --mode dry-run\ --system-config conf/common/system/example_slurm_cluster.toml\ --test-templates-dir conf/common/test_template\ - --tests-dir conf/common/tests\ + --tests-dir conf/common/test\ --test-scenario conf/common/test_scenario/sleep.toml ``` @@ -89,7 +89,7 @@ cloudai\ --mode run\ --system-config conf/common/system/example_slurm_cluster.toml\ --test-templates-dir conf/common/test_template\ - --tests-dir conf/common/tests\ + --tests-dir conf/common/test\ --test-scenario conf/common/test_scenario/sleep.toml ``` @@ -99,7 +99,7 @@ cloudai\ --mode generate-report\ --system-config conf/common/system/example_slurm_cluster.toml\ --test-templates-dir conf/common/test_template\ - --tests-dir conf/common/tests\ + --tests-dir conf/common/test\ --output-dir /path/to/output_directory ``` In the generate-report mode, use the --output-dir argument to specify a subdirectory under the result directory. @@ -111,7 +111,7 @@ cloudai\ --mode uninstall\ --system-config conf/common/system/example_slurm_cluster.toml\ --test-templates-dir conf/common/test_template\ - --tests-dir conf/common/tests + --tests-dir conf/common/test ``` ## Contributing diff --git a/pyproject.toml b/pyproject.toml index 64d8b2cc..4d9d2d91 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,7 @@ dependencies = [ "pandas==2.2.1", "tbparse==0.0.8", "toml==0.10.2", + "kubernetes==30.1.0", ] [build-system] diff --git a/tests/test_package.py b/tests/test_package.py new file mode 100644 index 00000000..eeb0344e --- /dev/null +++ b/tests/test_package.py @@ -0,0 +1,28 @@ +# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES +# Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import toml + + +def test_requirements(): + """ + Test that the requirements in the requirements.txt file are the same as the requirements in the pyproject.toml file. + """ + with open("requirements.txt", "r") as f: + requirements_txt = sorted(f.read().splitlines()) + with open("pyproject.toml", "r") as f: + requirements_toml = sorted(toml.load(f)["project"]["dependencies"]) + assert requirements_txt == requirements_toml diff --git a/tests/test_slurm_command_gen_strategy.py b/tests/test_slurm_command_gen_strategy.py index 9b00c1fb..c30f9852 100644 --- a/tests/test_slurm_command_gen_strategy.py +++ b/tests/test_slurm_command_gen_strategy.py @@ -602,6 +602,21 @@ def test_extra_args( self.assert_slurm_directives(file_contents.splitlines()) assert expected_str in file_contents + def test_reservation( + self, + strategy_fixture: SlurmCommandGenStrategy, + tmp_path: Path, + ): + strategy_fixture.slurm_system.extra_srun_args = "--reservation my-reservation" + args = self.MANDATORY_ARGS.copy() + + sbatch_command = strategy_fixture._write_sbatch_script(args, self.env_vars_str, self.srun_command, tmp_path) + filepath_from_command = sbatch_command.split()[-1] + with open(filepath_from_command, "r") as file: + file_contents = file.read() + + assert "#SBATCH --reservation=my-reservation" in file_contents + @pytest.mark.parametrize("add_arg", ["output", "error"]) def test_disable_output_and_error(self, add_arg: str, strategy_fixture: SlurmCommandGenStrategy, tmp_path: Path): args = self.MANDATORY_ARGS.copy()