Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Ramble 'concretized' flag #442

Merged
merged 5 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion etc/ramble/defaults/spack.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
spack:
concretized: false
packages: {}
environments: {}
1 change: 0 additions & 1 deletion examples/basic_expansion_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ ramble:
n_ranks: '1'
n_nodes: '1'
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected] target=x86_64
Expand Down
1 change: 0 additions & 1 deletion examples/basic_gromacs_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ ramble:
size: '0003'
type: 'rf'
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected] target=x86_64
Expand Down
1 change: 0 additions & 1 deletion examples/basic_hostname_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,5 @@ ramble:
n_nodes: '1'
processes_per_node: '16'
spack:
concretized: true
packages: {}
environments: {}
1 change: 0 additions & 1 deletion examples/full_expansion_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ ramble:
#(part1, 16, openfoam-skx, 2), (part1, 16, openfoam-skx, 4)
#(part2, 32, openfoam-zen2, 2), (part2, 32, openfoam-zen2, 4)
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected] target=x86_64
Expand Down
1 change: 0 additions & 1 deletion examples/vector_gromacs_software_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ ramble:
- n_ranks
- gromacs_version
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected] target=x86_64
Expand Down
1 change: 0 additions & 1 deletion examples/vector_matrix_gromacs_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ ramble:
- type
- n_ranks
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected] target=x86_64
Expand Down
1 change: 0 additions & 1 deletion lib/ramble/docs/configuration_files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,6 @@ environments created from those packages. Its format is as follows:
.. code-block:: yaml

spack:
concretized: [True/False] # Should be false unless defined in a concretized workspace
[variables: {}]
packages:
<package_name>:
Expand Down
3 changes: 0 additions & 3 deletions lib/ramble/docs/tutorials/10_using_modifiers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ The resulting configuration file should look like the following.
variables:
n_nodes: [1, 2]
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down Expand Up @@ -239,7 +238,6 @@ look like the following:
variables:
n_nodes: [1, 2]
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down Expand Up @@ -309,7 +307,6 @@ configuration file should look like the following:
variables:
n_nodes: [1, 2]
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down
3 changes: 0 additions & 3 deletions lib/ramble/docs/tutorials/11_using_internals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ the following:
variables:
n_nodes: [1, 2]
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down Expand Up @@ -245,7 +244,6 @@ configuration file should look like the following:
variables:
n_nodes: [1, 2]
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down Expand Up @@ -337,7 +335,6 @@ following:
variables:
n_nodes: [1, 2, 4]
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down
1 change: 0 additions & 1 deletion lib/ramble/docs/tutorials/1_hello_world.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ following contents:
variables:
n_ranks: '1'
spack:
concretized: true
packages: {}
environments: {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ The relevant portion of the workspace configuration file is:
.. code-block:: YAML

spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected] target=x86_64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ look like the following:
variables:
n_nodes: [1, 2]
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down
3 changes: 0 additions & 3 deletions lib/ramble/docs/tutorials/7_using_zips_and_matrices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ the above section. The result should look like the following:
variables:
n_nodes: [1, 2]
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down Expand Up @@ -203,7 +202,6 @@ should have the following in your ``ramble.yaml``:
- platform_config
- n_nodes
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down Expand Up @@ -266,7 +264,6 @@ Your final configuration file should look something like:
- platform_config
- n_nodes
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ final configuration from the previous tutorial.
- platform_config
- n_nodes
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down Expand Up @@ -193,7 +192,6 @@ generation as well. The result might look like the following:
- platform_config
- n_nodes
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down Expand Up @@ -264,7 +262,6 @@ into the matrix. The result might look like the following:
- n_nodes
- mpi_name
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down Expand Up @@ -374,7 +371,6 @@ resulting configuration might look like the following:
- n_nodes
- mpi_name
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down Expand Up @@ -464,7 +460,6 @@ The resulting configuration file might look like the following:
- n_nodes
- mpi_name
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down
2 changes: 0 additions & 2 deletions lib/ramble/docs/tutorials/9_success_criteria.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ configuration file might look like the following:
variables:
n_nodes: [1, 2]
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down Expand Up @@ -195,7 +194,6 @@ resulting configuration file might look like the following:
variables:
n_nodes: [1, 2]
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down
2 changes: 0 additions & 2 deletions lib/ramble/docs/tutorials/mirrors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ Write the following configuration into the file, save, and exit:
n_nodes: 1
processes_per_node: 30
spack:
concretized: false
packages: {}
environments: {}

Expand Down Expand Up @@ -94,7 +93,6 @@ will look something like this:
n_nodes: 1
processes_per_node: 30
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down
1 change: 0 additions & 1 deletion lib/ramble/docs/tutorials/shared/wrf_scaling_workspace.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ final configuration from a previous tutorial.
variables:
n_nodes: [1, 2]
spack:
concretized: true
packages:
gcc9:
spack_spec: [email protected]
Expand Down
11 changes: 10 additions & 1 deletion lib/ramble/ramble/cmd/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,21 @@ def workspace_remove(args):

def workspace_concretize_setup_parser(subparser):
"""Concretize a workspace"""
pass
subparser.add_argument(
'-f', '--force_concretize',
dapomeroy marked this conversation as resolved.
Show resolved Hide resolved
dest='force_concretize',
action='store_true',
help='Overwrite software environment configuration with defaults defined in application ' +
'definition',
required=False)


def workspace_concretize(args):
ws = ramble.cmd.require_active_workspace(cmd_name='workspace concretize')

if args.force_concretize:
ws.force_concretize = True

logger.debug('Concretizing workspace')
ws.concretize()

Expand Down
12 changes: 0 additions & 12 deletions lib/ramble/ramble/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,6 @@ def _construct_hash(self):
self.workspace.hash_file_name), 'w+') as f:
f.write(self.workspace.workspace_hash + '\n')

def _validate(self):
"""Perform validation that this pipeline can be executed"""
if not self.workspace.is_concretized():
error_message = 'Cannot run %s in a ' % self.name + \
'non-conretized workspace\n' + \
'Run `ramble workspace concretize` on this ' + \
'workspace first.\n' + \
'Then ensure its spack configuration is ' + \
'properly configured.'
logger.die(error_message)

def _prepare(self):
"""Perform preparation for pipeline execution"""
pass
Expand Down Expand Up @@ -203,7 +192,6 @@ def run(self):
)

logger.add_log(self.log_path)
self._validate()
self._prepare()
self._execute()
self._complete()
Expand Down
2 changes: 1 addition & 1 deletion lib/ramble/ramble/schema/spack.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'properties': {
'concretized': {
'type': 'boolean',
'default': False
'default': None
},
'variables': ramble.schema.variables.variables_def,
'zips': ramble.schema.zips.zips_def,
Expand Down
16 changes: 14 additions & 2 deletions lib/ramble/ramble/software_environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
# except according to those terms.

from enum import Enum
try:
import deprecation
except ImportError:
dapomeroy marked this conversation as resolved.
Show resolved Hide resolved
print('Please use pip to install the requirements.txt')

import ramble.repository
import ramble.workspace
Expand Down Expand Up @@ -413,7 +417,8 @@ class SoftwareEnvironments(object):
"""Class representing a group of software environments"""

_deprecated_sections = [namespace.variables, namespace.zips,
namespace.matrix, namespace.matrices, namespace.exclude]
namespace.matrix, namespace.matrices,
namespace.exclude, 'concretized']
dapomeroy marked this conversation as resolved.
Show resolved Hide resolved

def __init__(self, workspace):
"""SoftwareEnvironments constructor
Expand Down Expand Up @@ -457,6 +462,10 @@ def __str__(self):
"""
return self.info(indent=0)

@deprecation.deprecated(deprecated_in="0.4.0", removed_in="0.5.0",
current_version=str(ramble.ramble_version),
details="These Spack config sections no longer required and will "
"be removed from the schema in v0.5.0")
def _deprecated_warnings(self):
if not self._warn_for_deprecation or hasattr(self, '_warned_deprecation'):
return
Expand Down Expand Up @@ -485,9 +494,12 @@ def _deprecated_warnings(self):
sections_to_print.append('spack:packages:<name>:exclude')
sections_to_print.append('spack:environments:<name>:exclude')

if 'concretized' in self._warn_for_deprecation:
sections_to_print.append('spack:concretized')

if not hasattr(self, '_warned_deprecated_variables'):
self._warned_deprecated_variables = True
logger.warn('The following config sections are deprecated and ignore:')
logger.warn('The following config sections are deprecated and ignored:')
for section in sections_to_print:
logger.warn(f' {section}')
logger.warn('Please remove from your configuration files.')
Expand Down
5 changes: 4 additions & 1 deletion lib/ramble/ramble/test/application_language.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@

import pytest
import enum
import deprecation
try:
import deprecation
except ImportError:
print('Please use pip to install the requirements.txt')

from ramble.appkit import * # noqa

Expand Down
1 change: 0 additions & 1 deletion lib/ramble/ramble/test/application_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@ def test_derive_variables_for_template_path(mutable_mock_apps_repo):
n_nodes: '2'

spack:
concretized: true
packages: {}
environments: {}
"""
Expand Down
12 changes: 0 additions & 12 deletions lib/ramble/ramble/test/cmd/on.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ def test_on_command(mutable_mock_workspace_path):
ramble.test.cmd.workspace.add_basic(ws)
ramble.test.cmd.workspace.check_basic(ws)

workspace('concretize')
assert ws.is_concretized()

workspace('setup')
assert os.path.exists(ws.root + '/all_experiments')

Expand All @@ -58,9 +55,6 @@ def test_execute_pipeline(mutable_mock_workspace_path):
ramble.test.cmd.workspace.add_basic(ws)
ramble.test.cmd.workspace.check_basic(ws)

ws.concretize()
assert ws.is_concretized()

setup_pipeline = setup_pipeline_class(ws, filters)
setup_pipeline.run()
assert os.path.exists(ws.root + '/all_experiments')
Expand All @@ -77,9 +71,6 @@ def test_on_where(mutable_mock_workspace_path):
ramble.test.cmd.workspace.add_basic(ws)
ramble.test.cmd.workspace.check_basic(ws)

workspace('concretize')
assert ws.is_concretized()

workspace('setup')
assert os.path.exists(ws.root + '/all_experiments')

Expand All @@ -94,9 +85,6 @@ def test_on_executor(mutable_mock_workspace_path):
ramble.test.cmd.workspace.add_basic(ws)
ramble.test.cmd.workspace.check_basic(ws)

workspace('concretize')
assert ws.is_concretized()

workspace('setup')
assert os.path.exists(ws.root + '/all_experiments')

Expand Down
Loading
Loading