Skip to content
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

determine the toolchain generation in hooks #31

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

smoors
Copy link
Member

@smoors smoors commented Oct 1, 2024

  • determine the toolchain generation in hooks
  • remove --toolchain option
  • update tests

replaces #30

@smoors smoors marked this pull request as draft October 1, 2024 07:23
Comment on lines 73 to 85
def get_tc_versions():
" build dict of (sub)toolchain-versions per valid generation "
tc_versions = {}
for toolcgen in VALID_TCGENS:
tc_versions[toolcgen] = []
for toolc in VALID_TCS:
try:
tc_versions[toolcgen].extend(get_toolchain_hierarchy({'name': toolc, 'version': toolcgen}))
except EasyBuildError:
# skip if no easyconfig found for toolchain-version
pass

return tc_versions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that the dict returned by this method does not change during runtime. So it can be converted to a global constant.

Suggested change
def get_tc_versions():
" build dict of (sub)toolchain-versions per valid generation "
tc_versions = {}
for toolcgen in VALID_TCGENS:
tc_versions[toolcgen] = []
for toolc in VALID_TCS:
try:
tc_versions[toolcgen].extend(get_toolchain_hierarchy({'name': toolc, 'version': toolcgen}))
except EasyBuildError:
# skip if no easyconfig found for toolchain-version
pass
return tc_versions
# dict of (sub)toolchain-versions per valid generation "
TOOLCHAIN_VERSIONS = {}
for toolcgen in VALID_TCGENS:
TOOLCHAIN_VERSIONS[toolcgen] = []
for toolc in VALID_TCS:
try:
TOOLCHAIN_VERSIONS[toolcgen].extend(get_toolchain_hierarchy({'name': toolc, 'version': toolcgen}))
except EasyBuildError:
# skip if no easyconfig found for toolchain-version
pass

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i thought about this at first, but if it is set globally it will be calculated for every hook,
whereas the function will run only once for each easyconfig

src/build_tools/hooks_hydra.py Outdated Show resolved Hide resolved
@smoors smoors marked this pull request as ready for review October 4, 2024 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants