-
Notifications
You must be signed in to change notification settings - Fork 217
convert template constant lists to dicts and export the constants by name #4595
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
Conversation
Those are easier to handle as we can a) Access the names directly by iterating over the dict(-keys) b) Avoid duplications c) Make the semantic clearer d) Allow direct access of values by template name
This allows direct access to the template constants, e.g. for use in hooks. E.g.: `from easybuild.framework.easyconfig.templates import GITHUB_SOURCE`
afba995 to
9281587
Compare
Required after the conversion in easybuilders/easybuild-framework#4595
|
@Flamefire A merge conflict emerged here. Also, as a reminder: |
Already done -> easybuilders/easybuild-easyblocks#3410 :) |
722253b to
2785c55
Compare
Micket
left a comment
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.
lgtm
|
A few selected test reports uploaded to easybuilders/easybuild-easyblocks#3410 (comment) This seems fine to me. I haven't heard any objects to this. I would like to merge it, just want to check with others first. |
Required after the conversion in easybuilders/easybuild-framework#4595
| 'cuda_int_space_sep': 'Space-separated list of integer CUDA compute capabilities', | ||
| 'cuda_int_semicolon_sep': 'Semicolon-separated list of integer CUDA compute capabilities', | ||
| 'cuda_sm_comma_sep': 'Comma-separated list of sm_* values that correspond with CUDA compute capabilities', | ||
| 'cuda_sm_space_sep': 'Space-separated list of sm_* values that correspond with CUDA compute capabilities', |
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.
software_commit is missing here, I'll open a PR to add it back
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.
fixed in #4621
Required after the conversion in easybuilders/easybuild-framework#4595
Currently access to a constant by name is a bit awkward:
next(e[1] for e in TEMPLATE_CONSTANTS if e[0] == name)Also having them a list of strings or string and tuple of strings isn't obvious that it is rather a mapping of constants to values/documentation and not a real list. Thus it isn't clear either, that each name must only appear once.
This is a non-functional refactoring simplifying the code and improving the expressiveness.
E.g. to get all defined constants we can simply do:
list(TEMPLATE_CONSTANTS)(orlist(TEMPLATE_CONSTANTS.keys()))Additionally I included a change similar to the EasyConfig constants such that you can import them directly, e.g.
from easybuild.framework.easyconfig.templates import GITHUB_SOURCE