|
| 1 | +# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES |
| 2 | +# Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 3 | +# SPDX-License-Identifier: Apache-2.0 |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +import argparse |
| 18 | + |
| 19 | +import pytest |
| 20 | + |
| 21 | +from cloudai.cli.handlers import handle_dse_job |
| 22 | +from cloudai.core import Runner, TestDependency, TestRun, TestScenario |
| 23 | +from cloudai.systems.slurm.slurm_system import SlurmSystem |
| 24 | + |
| 25 | + |
| 26 | +@pytest.mark.parametrize("dep", ["start_post_comp", "start_post_init", "end_post_comp"]) |
| 27 | +def test_dse_run_does_not_support_dependencies( |
| 28 | + slurm_system: SlurmSystem, dse_tr: TestRun, dep: str, caplog: pytest.LogCaptureFixture |
| 29 | +) -> None: |
| 30 | + """ |
| 31 | + DSE runs do not support dependencies. |
| 32 | +
|
| 33 | + DSE engine re-uses BaseRunner by manually controlling test_run to execute. BaseRunner doesn't keep track of all jobs |
| 34 | + and their statuses, this information is not available between cases in a scenario or even between steps of a single |
| 35 | + test run. |
| 36 | +
|
| 37 | + While it might be useful in future, today we have to explicitly forbid such configurations and report actionable |
| 38 | + error to users. |
| 39 | + """ |
| 40 | + dse_tr.dependencies = {dep: TestDependency(test_run=dse_tr)} |
| 41 | + test_scenario: TestScenario = TestScenario(name="test_scenario", test_runs=[dse_tr]) |
| 42 | + runner = Runner(mode="dry-run", system=slurm_system, test_scenario=test_scenario) |
| 43 | + assert handle_dse_job(runner, argparse.Namespace(mode="dry-run")) == 1 |
| 44 | + assert "Dependencies are not supported for DSE jobs, all cases run consecutively." in caplog.text |
| 45 | + assert "Please remove dependencies and re-run." in caplog.text |
0 commit comments