-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from douglasjacobsen/package_manager_configs
Add support for package manager configs, and remove spack module generation
- Loading branch information
Showing
13 changed files
with
315 additions
and
25 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
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
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
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
71 changes: 71 additions & 0 deletions
71
lib/ramble/ramble/test/end_to_end/package_manager_config.py
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,71 @@ | ||
# Copyright 2022-2023 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
# https://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
# <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your | ||
# option. This file may not be copied, modified, or distributed | ||
# except according to those terms. | ||
|
||
import os | ||
|
||
import pytest | ||
|
||
import ramble.workspace | ||
import ramble.config | ||
import ramble.software_environments | ||
from ramble.main import RambleCommand | ||
|
||
|
||
pytestmark = pytest.mark.usefixtures('mutable_config', | ||
'mutable_mock_workspace_path') | ||
|
||
workspace = RambleCommand('workspace') | ||
|
||
|
||
def test_package_manager_config_zlib(mock_applications): | ||
test_config = """ | ||
ramble: | ||
variables: | ||
mpi_command: '' | ||
batch_submit: 'batch_submit {execute_experiment}' | ||
processes_per_node: '1' | ||
n_ranks: '1' | ||
applications: | ||
zlib-configs: | ||
workloads: | ||
ensure_installed: | ||
experiments: | ||
test: | ||
variables: {} | ||
spack: | ||
concretized: true | ||
packages: | ||
zlib: | ||
spack_spec: 'zlib' | ||
environments: | ||
zlib-configs: | ||
packages: | ||
- zlib | ||
""" | ||
|
||
workspace_name = 'test_package_manager_config_zlib' | ||
with ramble.workspace.create(workspace_name) as ws: | ||
ws.write() | ||
|
||
config_path = os.path.join(ws.config_dir, ramble.workspace.config_file_name) | ||
|
||
with open(config_path, 'w+') as f: | ||
f.write(test_config) | ||
ws._re_read() | ||
|
||
workspace('setup', '--dry-run', global_args=['-w', workspace_name]) | ||
|
||
spack_yaml = os.path.join(ws.software_dir, 'zlib-configs.ensure_installed', | ||
'spack.yaml') | ||
|
||
assert os.path.isfile(spack_yaml) | ||
|
||
with open(spack_yaml, 'r') as f: | ||
data = f.read() | ||
assert 'config:' in data | ||
assert 'debug: true' in data |
63 changes: 63 additions & 0 deletions
63
lib/ramble/ramble/test/modifier_functionality/mock_modifier_spack_configs.py
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,63 @@ | ||
# Copyright 2022-2023 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
# https://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
# <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your | ||
# option. This file may not be copied, modified, or distributed | ||
# except according to those terms. | ||
|
||
import os | ||
|
||
import pytest | ||
|
||
from ramble.test.dry_run_helpers import dry_run_config, SCOPES | ||
import ramble.test.modifier_functionality.modifier_helpers as modifier_helpers | ||
import ramble.workspace | ||
from ramble.main import RambleCommand | ||
|
||
workspace = RambleCommand('workspace') | ||
|
||
|
||
@pytest.mark.parametrize( | ||
'scope', | ||
[ | ||
SCOPES.workspace, | ||
SCOPES.application, | ||
SCOPES.workload, | ||
SCOPES.experiment, | ||
] | ||
) | ||
def test_gromacs_mock_spack_config_mod(mutable_mock_workspace_path, | ||
mutable_applications, | ||
mock_modifiers, | ||
scope): | ||
workspace_name = 'test_gromacs_mock_spack_config_mod' | ||
|
||
test_modifiers = [ | ||
(scope, modifier_helpers.named_modifier('spack-mod')), | ||
] | ||
|
||
with ramble.workspace.create(workspace_name) as ws1: | ||
ws1.write() | ||
|
||
config_path = os.path.join(ws1.config_dir, ramble.workspace.config_file_name) | ||
|
||
dry_run_config('modifiers', test_modifiers, config_path, 'gromacs', 'water_bare') | ||
|
||
ws1._re_read() | ||
|
||
workspace('concretize', global_args=['-D', ws1.root]) | ||
workspace('setup', '--dry-run', global_args=['-D', ws1.root]) | ||
exp_script = os.path.join(ws1.experiment_dir, 'gromacs', 'water_bare', | ||
'test_exp', 'execute_experiment') | ||
|
||
assert os.path.isfile(exp_script) | ||
|
||
spack_yaml = os.path.join(ws1.software_dir, 'gromacs.water_bare', | ||
'spack.yaml') | ||
assert os.path.isfile(spack_yaml) | ||
|
||
with open(spack_yaml, 'r') as f: | ||
data = f.read() | ||
|
||
assert 'debug: true' in data |
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
Oops, something went wrong.