Skip to content

Commit

Permalink
Merge branch 'main' into k8s-nccl-report-bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
TaekyungHeo authored Sep 10, 2024
2 parents a80dd2e + d96c0b6 commit 9b57912
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
```

Expand All @@ -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
```

Expand All @@ -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.
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies = [
"pandas==2.2.1",
"tbparse==0.0.8",
"toml==0.10.2",
"kubernetes==30.1.0",
]

[build-system]
Expand Down
28 changes: 28 additions & 0 deletions tests/test_package.py
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions tests/test_slurm_command_gen_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 9b57912

Please sign in to comment.