Add configs for reusing specs from environments and enable reuse from included concrete environments by default - #45139
Conversation
84f0472 to
d4b4f71
Compare
|
Currently the reuse concrete test is failing. I am able to get a successful concretization using a local environment test and cmake version, but getting the test to work the versions from virtuals is proving to be more finicky. |
tldahlgren
left a comment
There was a problem hiding this comment.
Very preliminary feedback...
|
Including @tgamblin per his off-line request. |
2abb121 to
50fc1d3
Compare
50fc1d3 to
d22b0ee
Compare
|
@kwryankrattiger can we get the tests passing on this one again? |
3cdafb7 to
8eb0ecc
Compare
|
After talking with @becker33 I think the way To make this simpler to reason about the concretization reuse settings for reusing concrete specs from included environments will move under the Here is an example of some use cases. The main additions here are adding the spack:
concretizer:
# Reuse from this environment (including included concrete) but not elsewhere
reuse:
from:
- type: environment
# or reuse from only my_env included environment
reuse:
from:
- type:
environment: my_env
# or reuse from everywhere
reuse: true
include-concrete:
- my_env
- my_other_env
... |
7e25b03 to
6d754a5
Compare
edaa792 to
3170cfc
Compare
becker33
left a comment
There was a problem hiding this comment.
I think we need another test (or maybe another parametrization) for testing reusing from an environment that is not included.
This is looking good in general, I think it's getting close
|
@becker33 I am thinking about the case of Any ideas on how to express that? I was thinking about adding an option value force. Maybe something like My thought on this is I maybe be consuming someone else's concrete environment and iterating, but they changed their lock and I didn't want to update yet. The idea of requiring |
I added tests for reuse of non-existent mirror ( I also noticed that we were not correctly distinguishing between included and external environments when reusing the environment by path/name. I added a check and a |
Add new reuse type "environment". Add reuse selector to select all concrete specs from an environment. Signed-off-by: Ryan Krattiger <ryan.krattiger@kitware.com>
* Add more dimensions to the reuse included concrete environments test * Test changing and reconcretizing the included environment does not change the combined environment. * Add a helper to getting an environment from name or path
cab66fb to
12aa8a5
Compare
I don't think we should do anything to enable reusing without updating the concretizations from the upstream environment. Updating your included environments is part of the contract of |
I agree with that. But there are cases where I want to keep by current includes, but I have modified other parts of my environment that I want to re-concretize against. I am thinking about a different option which does I don't think it needs to be in the PR, just a thought. |
12aa8a5 to
7c93ac0
Compare
|
Just saw this change on from:
- type:
environment: my_envinstead of this choice: from:
- type: environment
name: my_envwhich could have also applied to buildcaches: from:
- type: buildcache
name: developer-toolsAre we in time for a hotfix in case? 🙂 EDIT: The issue I see with this is the one we do frequently to encode specific information in a key, which makes the schema not easily extendable. The example above with EDIT2: If |
|
@kwryankrattiger or @becker33 can you please update the description here to be more descriptive? |
| # If environment is included as a concrete environment, use the local copy | ||
| # of specs in the active environment. | ||
| # note: included concrete environments are only updated at concretization | ||
| # time, and reuse needs to matchthe included specs. | ||
| self.reuse_sources.append( | ||
| SpecFilter.from_environment_included_concrete( | ||
| self.configuration, | ||
| include=include, | ||
| exclude=exclude, | ||
| env=active_env, | ||
| included_concrete=env_dir, | ||
| ) | ||
| ) |
There was a problem hiding this comment.
@kwryankrattiger I have two questions on this PR as I'm trying to implement #49707
- This feature was never documented. Was that on purpose because it's "experimental" etc. or should we document it?
- Why do we reuse a possibly outdated version of a lockfile if the environment is among the included environments?
There was a problem hiding this comment.
- So as far as this goes it was more a bug fix than a new feature imo We could probably improve the documentation around this a bit more though, but it wasn't part of the scope of this change.
- For the case of include concrete part of the feature was to include a "snapshot" of a concrete environment. It is up to the user to say when to update the included concrete lockfile. That should be handled via the
-fflag.
| if unify: | ||
| assert mpileaks["mpi"].dag_hash() in test1_roots | ||
| assert mpileaks["libelf"].dag_hash() in test2_roots | ||
| else: | ||
| # check that unification is not by accident | ||
| assert mpileaks["mpi"].dag_hash() not in test1_roots |
There was a problem hiding this comment.
I just found out that these tests are buggy, since they don't reflect what user would see when working with an environment from cli.
The issue is that to compute reused specs we always rely on the active_environment, while here we concretize the combined environment outside of:
with combined:
...so there is no active_environment. If there was, a few assertions on unify: false would fail.
Question is: would it be fine to change the expectations to match the current behavior (i.e. specs from an included environment are "reused" when unify: false)? I would say "yes" since it will be more consistent in general to behave like that, but wondering if there are use cases I missed.
There was a problem hiding this comment.
The distinction between reuse and unify are important here. unfiy:false will disable the strict unification, but if reuse:true then we will include existing environment specs (ie. the included concrete specs) as reusable.
It is also possible to configure unify:false and only reuse from some of the included concrete environments.
Here you include foo and bar, but only reuse from foo when solving. bar specs are just injected into the environment in addition, but they are not to be included in the solve.
include_concrete:
- foo
- bar
unify: false
reuse:
from: [
type: environment
path: foo
]
Add option to reuse specs from included concrete environments. The default is to reuse.