-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass install_path to SlurmInstallStrategy
Co-authored-by: Lior Paz <liorpa@nvidia.com>
- Loading branch information
1 parent
967e7d7
commit c97c6c6
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
from cloudai.systems import SlurmSystem | ||
from cloudai.systems.slurm import SlurmNode, SlurmNodeState | ||
from cloudai.systems.slurm.strategy import SlurmInstallStrategy | ||
|
||
|
||
@pytest.fixture | ||
def slurm_system(tmp_path: Path) -> SlurmSystem: | ||
slurm_system = SlurmSystem( | ||
name="TestSystem", | ||
install_path=str(tmp_path / "install"), | ||
output_path=str(tmp_path / "output"), | ||
default_partition="main", | ||
partitions={ | ||
"main": [ | ||
SlurmNode(name="node1", partition="main", state=SlurmNodeState.IDLE), | ||
SlurmNode(name="node2", partition="main", state=SlurmNodeState.IDLE), | ||
SlurmNode(name="node3", partition="main", state=SlurmNodeState.IDLE), | ||
SlurmNode(name="node4", partition="main", state=SlurmNodeState.IDLE), | ||
] | ||
}, | ||
) | ||
Path(slurm_system.install_path).mkdir() | ||
Path(slurm_system.output_path).mkdir() | ||
return slurm_system | ||
|
||
|
||
@pytest.fixture | ||
def slurm_install_strategy(slurm_system: SlurmSystem) -> SlurmInstallStrategy: | ||
env_vars = {"TEST_VAR": "VALUE"} | ||
cmd_args = {"docker_image_url": {"default": "http://example.com/docker_image"}} | ||
strategy = SlurmInstallStrategy(slurm_system, env_vars, cmd_args) | ||
return strategy | ||
|
||
|
||
def test_install_path_attribute(slurm_install_strategy: SlurmInstallStrategy, slurm_system: SlurmSystem): | ||
assert slurm_install_strategy.install_path == slurm_system.install_path |