Skip to content

Commit

Permalink
Allow empty spack environments when constructing hash
Browse files Browse the repository at this point in the history
When building an experiment / workspace inventory, previously it was
required that if an environment had a spack.yaml, it also created a
spack.lock (or Ramble would error).

This commit allows spack.yaml files that have no packages (And thus,
won't concretized into a spack.lock) without throwing an error.
  • Loading branch information
douglasjacobsen committed Dec 7, 2023
1 parent 6eb0066 commit 8d1c093
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/ramble/ramble/spack_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ def inventory_hash(self, require_exist=False):
contents_to_hash = None

if not self.dry_run:
if not lock_exists and require_exist:
if not lock_exists and (require_exist or len(self.env_contents) == 0):
logger.die(
'spack.lock file does not exist in environment '
f'{self.env_path}\n'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@ def test_unsetup_workspace_cannot_analyze(mutable_config,
MY_VAR: 'TEST'
spack:
concretized: true
packages: {}
environments: {}
packages:
zlib:
spack_spec: zlib
environments:
zlib:
packages:
- zlib
"""
workspace_name = 'test_unsetup_workspace_cannot_analyze'
with ramble.workspace.create(workspace_name) as ws:
Expand Down

0 comments on commit 8d1c093

Please sign in to comment.