Skip to content

Include concrete environments with include_concrete#33768

Merged
tgamblin merged 1 commit intospack:developfrom
RikkiButler20:feature/combined-environments
May 7, 2024
Merged

Include concrete environments with include_concrete#33768
tgamblin merged 1 commit intospack:developfrom
RikkiButler20:feature/combined-environments

Conversation

@RikkiButler20
Copy link
Copy Markdown
Contributor

@RikkiButler20 RikkiButler20 commented Nov 8, 2022

Resolves #33313

Add the ability to include any number of (potentially nested) concrete environments, e.g.:

   spack:
     specs: []
     concretizer:
         unify: true
     include_concrete:
     - /path/to/environment1
     - /path/to/environment2

or, from the CLI:

   $ spack env create myenv
   $ spack -e myenv add python
   $ spack -e myenv concretize
   $ spack env create --include-concrete myenv included_env

The contents of included concrete environments' spack.lock files are
included in the environment's lock file at creation time. Any changes
to included concrete environments are only reflected after the environment
is re-concretized from the re-concretized included environments.

  • Concretize included envs
  • Save concrete specs in memory by hash
  • Add included envs to combined env's lock file
  • Add test
  • Update documentation

@RikkiButler20 RikkiButler20 self-assigned this Nov 8, 2022
@spackbot-app spackbot-app bot added commands core PR affects Spack core functionality labels Nov 8, 2022
@RikkiButler20
Copy link
Copy Markdown
Contributor Author

@spackbot fix style

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Nov 9, 2022

Let me see if I can fix that for you!

@RikkiButler20 RikkiButler20 marked this pull request as draft November 9, 2022 21:46
@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Nov 9, 2022

I was able to run spack style --fix for you!

spack style --fix
==> Running style checks on spack
  selected: isort, mypy, black, flake8
==> Modified files
  lib/spack/spack/cmd/env.py
==> Running isort checks
  isort checks were clean
==> Running mypy checks
Success: no issues found in 569 source files
  mypy checks were clean
==> Running black checks
reformatted lib/spack/spack/cmd/env.py
All done! ✨ 🍰 ✨
1 file reformatted.
  black checks were clean
==> Running flake8 checks
  flake8 checks were clean
==> spack style checks were clean
Keep in mind that I cannot fix your flake8 or mypy errors, so if you have any you'll need to fix them and update the pull request. If I was able to push to your branch, if you make further changes you will need to pull from your updated branch before pushing again.

I've updated the branch with style fixes.

@RikkiButler20
Copy link
Copy Markdown
Contributor Author

@spackbot fix style

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Nov 15, 2022

Let me see if I can fix that for you!

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Nov 15, 2022

I was able to run spack style --fix for you!

spack style --fix
==> Running style checks on spack
  selected: isort, mypy, black, flake8
==> Modified files
  lib/spack/spack/cmd/env.py
  lib/spack/spack/environment/environment.py
==> Running isort checks
  isort checks were clean
==> Running mypy checks
lib/spack/llnl/util/lang.py:1076: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/spack/llnl/util/lock.py:84: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/spack/spack/bootstrap.py:89: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
Success: no issues found in 569 source files
  mypy checks were clean
==> Running black checks
reformatted lib/spack/spack/cmd/env.py
All done! ✨ 🍰 ✨
1 file reformatted, 1 file left unchanged.
  black checks were clean
==> Running flake8 checks
  flake8 checks were clean
==> spack style checks were clean
Keep in mind that I cannot fix your flake8 or mypy errors, so if you have any you'll need to fix them and update the pull request. If I was able to push to your branch, if you make further changes you will need to pull from your updated branch before pushing again.

I've updated the branch with style fixes.

@RikkiButler20
Copy link
Copy Markdown
Contributor Author

@spackbot fix style

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Nov 16, 2022

Let me see if I can fix that for you!

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Nov 16, 2022

I was able to run spack style --fix for you!

spack style --fix
==> Running style checks on spack
  selected: isort, mypy, black, flake8
==> Modified files
  lib/spack/spack/cmd/env.py
  lib/spack/spack/environment/environment.py
==> Running isort checks
  isort checks were clean
==> Running mypy checks
lib/spack/llnl/util/lang.py:1076: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/spack/llnl/util/lock.py:84: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/spack/spack/bootstrap.py:89: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
Success: no issues found in 569 source files
  mypy checks were clean
==> Running black checks
reformatted lib/spack/spack/cmd/env.py
All done! ✨ 🍰 ✨
1 file reformatted, 1 file left unchanged.
  black checks were clean
==> Running flake8 checks
  flake8 checks were clean
==> spack style checks were clean
Keep in mind that I cannot fix your flake8 or mypy errors, so if you have any you'll need to fix them and update the pull request. If I was able to push to your branch, if you make further changes you will need to pull from your updated branch before pushing again.

I've updated the branch with style fixes.

@RikkiButler20
Copy link
Copy Markdown
Contributor Author

@spackbot fix style

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Dec 13, 2022

Let me see if I can fix that for you!

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Dec 13, 2022

I was able to run spack style --fix for you!

spack style --fix
==> Running style checks on spack
  selected: isort, mypy, black, flake8
==> Modified files
  lib/spack/spack/cmd/env.py
  lib/spack/spack/environment/environment.py
  lib/spack/spack/schema/env.py
==> Running isort checks
  isort checks were clean
==> Running mypy checks
lib/spack/llnl/util/lang.py:1076: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/spack/llnl/util/lock.py:84: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/spack/spack/bootstrap.py:89: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
Success: no issues found in 569 source files
  mypy checks were clean
==> Running black checks
reformatted lib/spack/spack/cmd/env.py
reformatted lib/spack/spack/environment/environment.py
All done! ✨ 🍰 ✨
2 files reformatted, 1 file left unchanged.
  black checks were clean
==> Running flake8 checks
lib/spack/spack/environment/environment.py:934: [F841] local variable 'new_dict_roots' is assigned to but never used
lib/spack/spack/environment/environment.py:935: [F841] local variable 'lockfile_meta' is assigned to but never used
lib/spack/spack/environment/environment.py:945: [F841] local variable 'old_env' is assigned to but never used
lib/spack/spack/environment/environment.py:945: [F821] undefined name 'Envinronment'
  flake8 found errors
Keep in mind that I cannot fix your flake8 or mypy errors, so if you have any you'll need to fix them and update the pull request. If I was able to push to your branch, if you make further changes you will need to pull from your updated branch before pushing again.

I've updated the branch with style fixes.

@RikkiButler20
Copy link
Copy Markdown
Contributor Author

@spackbot fix style

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Dec 15, 2022

Let me see if I can fix that for you!

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Dec 15, 2022

I was able to run spack style --fix for you!

spack style --fix
==> Running style checks on spack
  selected: isort, mypy, black, flake8
==> Modified files
  lib/spack/spack/cmd/env.py
  lib/spack/spack/environment/environment.py
  lib/spack/spack/schema/env.py
==> Running isort checks
  isort checks were clean
==> Running mypy checks
lib/spack/llnl/util/lang.py:1064: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/spack/spack/util/timer.py:68: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/spack/spack/build_environment.py:291: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/spack/spack/bootstrap/_common.py:52: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
Success: no issues found in 571 source files
  mypy checks were clean
==> Running black checks
reformatted lib/spack/spack/cmd/env.py
reformatted lib/spack/spack/environment/environment.py
All done! ✨ 🍰 ✨
2 files reformatted, 1 file left unchanged.
  black checks were clean
==> Running flake8 checks
  flake8 checks were clean
==> spack style checks were clean
Keep in mind that I cannot fix your flake8 or mypy errors, so if you have any you'll need to fix them and update the pull request. If I was able to push to your branch, if you make further changes you will need to pull from your updated branch before pushing again.

I've updated the branch with style fixes.

@RikkiButler20
Copy link
Copy Markdown
Contributor Author

@spackbot fix style

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Jan 13, 2023

Let me see if I can fix that for you!

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Jan 13, 2023

I was able to run spack style --fix for you!

spack style --fix
==> Running style checks on spack
  selected: isort, black, flake8, mypy
==> Modified files
  lib/spack/spack/cmd/env.py
  lib/spack/spack/environment/environment.py
  lib/spack/spack/schema/env.py
==> Running isort checks
  isort checks were clean
==> Running black checks
All done! ✨ 🍰 ✨
3 files left unchanged.
  black checks were clean
==> Running flake8 checks
  flake8 checks were clean
==> Running mypy checks
Success: no issues found in 571 source files
  mypy checks were clean
==> spack style checks were clean
Keep in mind that I cannot fix your flake8 or mypy errors, so if you have any you'll need to fix them and update the pull request. If I was able to push to your branch, if you make further changes you will need to pull from your updated branch before pushing again.

I wasn't able to make any further changes, but please see the message above for remaining issues you can fix locally!

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Mar 25, 2024

I was able to run spack style --fix for you!

spack style --fix
==> Running style checks on spack
  selected: isort, black, flake8, mypy
==> Modified files
  lib/spack/spack/cmd/env.py
  lib/spack/spack/cmd/find.py
  lib/spack/spack/environment/__init__.py
  lib/spack/spack/environment/environment.py
  lib/spack/spack/schema/env.py
  lib/spack/spack/test/cmd/env.py
  lib/spack/spack/test/cmd/find.py
==> Running isort checks
  isort checks were clean
==> Running black checks
reformatted lib/spack/spack/environment/environment.py
All done! ✨ 🍰 ✨
1 file reformatted, 6 files left unchanged.
  black checks were clean
==> Running flake8 checks
  flake8 checks were clean
==> Running mypy checks
Success: no issues found in 619 source files
  mypy checks were clean
==> spack style checks were clean
Keep in mind that I cannot fix your flake8 or mypy errors, so if you have any you'll need to fix them and update the pull request. If I was able to push to your branch, if you make further changes you will need to pull from your updated branch before pushing again.

I've updated the branch with style fixes.

@RikkiButler20
Copy link
Copy Markdown
Contributor Author

@spackbot fix style

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Mar 29, 2024

Let me see if I can fix that for you!

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Mar 29, 2024

I was able to run spack style --fix for you!

spack style --fix
==> Running style checks on spack
  selected: isort, black, flake8, mypy
==> Modified files
  lib/spack/spack/cmd/env.py
  lib/spack/spack/cmd/find.py
  lib/spack/spack/environment/__init__.py
  lib/spack/spack/environment/environment.py
  lib/spack/spack/schema/env.py
  lib/spack/spack/test/cmd/env.py
  lib/spack/spack/test/cmd/find.py
==> Running isort checks
  isort checks were clean
==> Running black checks
reformatted lib/spack/spack/cmd/env.py
All done! ✨ 🍰 ✨
1 file reformatted, 6 files left unchanged.
  black checks were clean
==> Running flake8 checks
lib/spack/spack/test/cmd/env.py:1819: [F841] local variable 'lockfile_as_dict' is assigned to but never used
  flake8 found errors
==> Running mypy checks
Success: no issues found in 619 source files
  mypy checks were clean
Keep in mind that I cannot fix your flake8 or mypy errors, so if you have any you'll need to fix them and update the pull request. If I was able to push to your branch, if you make further changes you will need to pull from your updated branch before pushing again.

I've updated the branch with style fixes.

@tldahlgren
Copy link
Copy Markdown
Contributor

Interesting that it has been 6 hours and prechecks are still in Waiting for status to be reported with only readthedocs completed. Could it be conflicts related?

@tldahlgren
Copy link
Copy Markdown
Contributor

@spackbot help

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Apr 23, 2024

You can interact with me in many ways!

  • @spackbot hello: say hello and get a friendly response back!
  • @spackbot help or @spackbot commands: see this message
  • @spackbot run pipeline or @spackbot re-run pipeline: to request a new run of the GitLab CI pipeline
  • @spackbot rebuild everything: to run a pipeline rebuilding all specs from source.
  • @spackbot fix style if you have write and would like me to run spack style --fix for you.
  • @spackbot maintainers or @spackbot request review: to look for and assign reviewers for the pull request.

I'll also help to label your pull request and assign reviewers!
If you need help or see there might be an issue with me, open an issue here

@tldahlgren
Copy link
Copy Markdown
Contributor

TBD. Will closing and re-opening force pre-checks to complete despite conflicts?

@tldahlgren
Copy link
Copy Markdown
Contributor

I think this still needs a test for the following:

$ spack env create test1
$ spack -e test1 add foo
$ spack -e test1 concretize
$ spack env create --include-concrete test1 test2
$ spack -e test2 add bar
$ spack -e test2 concretize
$ spack env create --include-concrete test2 test3
$ spack -e test3 concretize
# should include foo and bar

There is a unit test -- test_concretize_nested_included_concrete -- that goes further to not only demonstrate the expected effects when two environments include the same environment concretized before and after a spec change (respectively) but to also exercise a case where those two environments are included in a fourth before and after reconcretization.

Goals of the test are to demonstrate:

  1. each environment including a concrete environment has the concretized specs at creation time;
  2. changes to the included environment are not reflected in the including environment until both are re-concretized; and
  3. numbers 1 and 2 apply for nested included environments.

@tldahlgren
Copy link
Copy Markdown
Contributor

tldahlgren commented Apr 30, 2024

What is the synchronization policy between this environment and the included one (if e.g. the included environment changes independently)?

IMO test_concrete_nested_included_concrete illustrates the sequence as I understand it.

Creation of an environment that includes a concrete environment will have its concrete specs at creation time. The only way the environment will reflect changes in an updated and re-concretized included environment is if the environment itself is re-concretized. The same principle applies for nested included environments.

For example, if a includes b and b includes c, a can only reflect changes to c if b is re-concretized to reflect those changes before a is re-concretized.

At least that's how the code is currently implemented.

tgamblin
tgamblin previously approved these changes May 6, 2024
@tldahlgren
Copy link
Copy Markdown
Contributor

@alalazo @becker33 Is it okay to resolve the remaining conversations so we can merge this PR?

@tgamblin
Copy link
Copy Markdown
Member

tgamblin commented May 6, 2024

planning to after I deconflict it

@tldahlgren
Copy link
Copy Markdown
Contributor

planning to after I deconflict it

Okay. I was just starting to do that but won't if you've already started.

Add the ability to include any number of (potentially nested) concrete
environments.

The contents of included concrete environments' spack.lock files are
included in the environment's lock file at creation time. Any changes
to included concrete environments are only reflected after the environment
is re-concretized from the re-concretized included environments.

    Co-authored-by: Kayla Butler <<[email protected]>
    Co-authored-by: Tamara Dahlgren <[email protected]
m>
    Co-authored-by: Todd Gamblin <[email protected]>
@tldahlgren
Copy link
Copy Markdown
Contributor

The CodeCov numbers currently reported in the checks do not look right at all.

Following Details -> View this Pull Request on CodeCov I see +.01% change (head 83.06%, patch 90.70%).

@alalazo
Copy link
Copy Markdown
Member

alalazo commented May 7, 2024

Is it okay to resolve the remaining conversations so we can merge this PR?

If we are in a hurry to merge a PR, in my opinion we should leave open discussions open and force merge. In that way point of discussions are easier to spot later. Otherwise the "Unresolved conversations" will just push us to close stuff only to the detriment of our workflows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-systems commands core PR affects Spack core functionality dependencies documentation Improvements or additions to documentation environments gitlab Issues related to gitlab integration headers libraries modules new-package new-variant new-version patch python shell-support stand-alone-tests Stand-alone (or smoke) tests for installed packages tests General test capability(ies) update-package virtual-dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Combine Environments Under One View

5 participants