ASP-based solver: don't error for type mismatch on preferences#41138
ASP-based solver: don't error for type mismatch on preferences#41138haampie merged 4 commits intospack:developfrom
Conversation
lib/spack/spack/solver/asp.py
Outdated
| spec.update_variant_validate(variant_name, values) | ||
| try: | ||
| spec.update_variant_validate(variant_name, values) | ||
| except spack.error.SpackError: |
There was a problem hiding this comment.
Do we have a more specific exception for this? Like VariantValueError or whatever?
There was a problem hiding this comment.
Also, what about requirements?
Requirements are fine already. They will error, unless the requirement comes from the all: section in packages.yaml:
spack/lib/spack/spack/solver/asp.py
Lines 1710 to 1715 in 868a3c4
The overall idea there is that, since requirements are stricter, we shouldn't silently skip them if they cannot be applied.1
Footnotes
-
Think of a typo like
+opnmp. It would be better to error, than to skip and concretize to the opposite value. ↩
There was a problem hiding this comment.
Why guard against a typo +opnmp if +openmp errors because the vast majority of the package don't have that variant. It's guarding against typos so in return you can do ... nothing?
There was a problem hiding this comment.
I'll repeat. For requirements all: is permissive, specific packages are not.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
847311f to
645ee8d
Compare
|
To me the sensible thing to do is make requirements behave the same: packages:
all:
require: +cudashould require That's the only way in which all-type variant requirements can possibly be useful, cause no variant exists (except for build_system) that is shared across all packages, making it impossible to use by definition. |
|
The It's equivalent to a preference that's stronger than reuse? |
Yes. It will be mostly equivalent due to the priority we give to requirements, but not exactly equivalent to a requirement specified on the package. The fact that we are a bit more permissive with spack:
zlib:
require: +sharedusers cannot concretize or solve anything that explicitly needs With: spack:
all:
require:
- any_of: ["+shared", "@:"]explicits request are possible: We can also have the same semantic for the two cases, which favors consistency, but in that case the occasional concretization of |
|
Variants aren't the only requirement you can add in |
They will be ignored when either explicitly set or required in a spec literal. That said, I also pointed out the other option and the consequence:
I don't have a preferred option, and both are doable. |
|
I feel like "enforce when applicable" is the least surprising interpretation of requirements under
This leaves room for people to relax from strong requirement to "strong preference" with that any_of construct (for which we can always still improve syntax). |
|
So let's get this bug fix in and work on the improvement in the next PR? |
…#41138) This commit discards type mismatches or failures to validate a package preference during concretization. The values discarded are logged as debug level messages. It also adds a config audit to help users spot misconfigurations in packages.yaml preferences.
…#41138) This commit discards type mismatches or failures to validate a package preference during concretization. The values discarded are logged as debug level messages. It also adds a config audit to help users spot misconfigurations in packages.yaml preferences.
This commit discards type mismatches or failures to validate a package preference during concretization. The values discarded are logged as debug level messages. It also adds a config audit to help users spot misconfigurations in packages.yaml preferences.
This commit discards type mismatches or failures to validate a package preference during concretization. The values discarded are logged as debug level messages. It also adds a config audit to help users spot misconfigurations in packages.yaml preferences.
This commit discards type mismatches or failures to validate a package preference during concretization. The values discarded are logged as debug level messages. It also adds a config audit to help users spot misconfigurations in packages.yaml preferences.
…#41138) This commit discards type mismatches or failures to validate a package preference during concretization. The values discarded are logged as debug level messages. It also adds a config audit to help users spot misconfigurations in packages.yaml preferences.
…#41138) This commit discards type mismatches or failures to validate a package preference during concretization. The values discarded are logged as debug level messages. It also adds a config audit to help users spot misconfigurations in packages.yaml preferences.

fixes #41134
This PR discards type mismatches or failures to validate a package preference during concretization. The values discarded are logged as debug level messages. It also adds a config audit to help users spot misconfigurations in
packages.yamlpreferences.