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

add build_and_install_loop hooks to run before and after the install loop for individual easyconfigs #4304

Merged
merged 18 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion easybuild/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
from easybuild.tools.github import add_pr_labels, install_github_token, list_prs, merge_pr, new_branch_github, new_pr
from easybuild.tools.github import new_pr_from_branch
from easybuild.tools.github import sync_branch_with_develop, sync_pr_with_develop, update_branch, update_pr
from easybuild.tools.hooks import START, END, load_hooks, run_hook
from easybuild.tools.hooks import BUILD_AND_INSTALL_LOOP, PRE_PREF, POST_PREF, START, END, load_hooks, run_hook
from easybuild.tools.modules import modules_tool
from easybuild.tools.options import opts_dict_to_eb_opts, set_up_configuration, use_color
from easybuild.tools.output import COLOR_GREEN, COLOR_RED, STATUS_BAR, colorize, print_checks, rich_live_cm
Expand Down Expand Up @@ -545,8 +545,10 @@ def process_eb_args(eb_args, eb_go, cfg_settings, modtool, testing, init_session
exit_on_failure = not (options.dump_test_report or options.upload_test_report)

with rich_live_cm():
run_hook(PRE_PREF + BUILD_AND_INSTALL_LOOP, hooks, args=[ordered_ecs])
ecs_with_res = build_and_install_software(ordered_ecs, init_session_state,
exit_on_failure=exit_on_failure)
run_hook(POST_PREF + BUILD_AND_INSTALL_LOOP, hooks, args=[ecs_with_res])
else:
ecs_with_res = [(ec, {}) for ec in ordered_ecs]

Expand Down
3 changes: 3 additions & 0 deletions easybuild/tools/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@

START = 'start'
PARSE = 'parse'
BUILD_AND_INSTALL_LOOP = 'build_and_install_loop'
SINGLE_EXTENSION = 'single_extension'
MODULE_WRITE = 'module_write'
END = 'end'
Expand All @@ -78,6 +79,7 @@
HOOK_NAMES = [
START,
PARSE,
PRE_PREF + BUILD_AND_INSTALL_LOOP,
] + [p + x for x in STEP_NAMES[:STEP_NAMES.index(EXTENSIONS_STEP)]
for p in [PRE_PREF, POST_PREF]] + [
# pre-extensions hook is triggered before starting installation of extensions,
Expand All @@ -97,6 +99,7 @@
POST_PREF + MODULE_STEP,
] + [p + x for x in STEP_NAMES[STEP_NAMES.index(MODULE_STEP)+1:]
for p in [PRE_PREF, POST_PREF]] + [
POST_PREF + BUILD_AND_INSTALL_LOOP,
END,
]
KNOWN_HOOKS = [h + HOOK_SUFF for h in HOOK_NAMES]
Expand Down
2 changes: 2 additions & 0 deletions test/framework/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ def test_avail_hooks(self):
"List of supported hooks (in order of execution):",
" start_hook",
" parse_hook",
" pre_build_and_install_loop_hook",
branfosj marked this conversation as resolved.
Show resolved Hide resolved
" pre_fetch_hook",
" post_fetch_hook",
" pre_ready_hook",
Expand Down Expand Up @@ -716,6 +717,7 @@ def test_avail_hooks(self):
" post_package_hook",
" pre_testcases_hook",
" post_testcases_hook",
" post_build_and_install_loop_hook",
branfosj marked this conversation as resolved.
Show resolved Hide resolved
" end_hook",
'',
])
Expand Down