-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Assign priorities to configuration scopes #48420
base: develop
Are you sure you want to change the base?
Assign priorities to configuration scopes #48420
Conversation
Up to now configuration behaved like a stack, where scopes could be only be pushed at the top. This commit allows to assign priorities to scopes, and ensures that scopes of lower priorities are always "below" scopes of higher priorities. When scopes have the same priority, what matters is the insertion order.
The function is only used in a fixture, and it can be substituted with already existing code.
2b17111
to
8c0cc36
Compare
Failure in pipelines is unrelated, and due to system errors: |
lib/spack/llnl/util/lang.py
Outdated
if key in self._data: | ||
self.remove(key) | ||
|
||
self._priorities.append((priority, self._new_id(), key)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sort
/sorted
is stable, so no need for _new_id()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need that It's useful to be defensive when iterating (in case a new function scrambles the order of _priorities
).
EDIT: I changed that in 87752f1 This is more similar to my first implementation, which I modified by adding _new_id()
out of possibly an abundance of caution - motivated by the numerous bugs we had with config scopes order. If we have a second thought, and want to get back to having an explicit index, we can drop the commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've looked over the code and the concept seems sound to me. The idea of stack like behavior within a given priority is a more robust design. It also seems truer to our description of how configs will work with the users. I'm still mulling a bit about the defaults selected but not to the point of wanting to hold up a merge. Thanks @alalazo for taking the time to shore up this design.
I don't see any code change in bootstrap 🤔 what about
bootstrapping to /tmp instead of ~/.spack/bootstrap? |
@haampie There shouldn't be any change to bootstrap. The bootstrap store is specified in another place, so if you want to modify it from the command line you should: $ spack -c bootstrap:root:/tmp spec zlib even though the simpler way to do it is: $ spack bootstrap root /tmp Anyhow, I'm not aiming at changing any bootstrap semantic in this PR. |
fixes #48414
Up to now configuration behaved like a stack, where scopes could be only be pushed at the top. This PR allows to assign priorities to scopes, and ensures that scopes of lower priorities are always "below" scopes of higher priorities.
When scopes have the same priority, what matters is the insertion order.
Modifications:
Configuration
constructor f1d0371Configuration.pop_scope
61dd2f2