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

module function check does not support Environment Modules #4368

Closed
xdelaruelle opened this issue Oct 28, 2023 · 1 comment · Fixed by #4371
Closed

module function check does not support Environment Modules #4368

xdelaruelle opened this issue Oct 28, 2023 · 1 comment · Fixed by #4371
Milestone

Comments

@xdelaruelle
Copy link
Contributor

When trying to use EB with Environment Modules, the module function check raises an error:

$ eb --modules-tool EnvironmentModules --module-syntax Tcl 
== Temporary log file in case of crash /tmp/eb-snqwtxzg/easybuild-gvwalsbq.log
ERROR: pattern '.*modulecmd.tcl' (Environment Modules) not found in defined 'module' function.
Specify the correct modules tool to avoid weird problems due to this mismatch, see the --modules-tool and --avail-modules-tools command line options.
Or alternatively, use --allow-modules-tool-mismatch to stop treating this as an error. Obtained definition of 'module' function: module is a function
module ()  
{ 
    local _mlredir=1;
    if [ -n "${MODULES_REDIRECT_OUTPUT+x}" ]; then
    |   if [ "$MODULES_REDIRECT_OUTPUT" = '0' ]; then
    |   ¦   _mlredir=0;
    |   else
    |   ¦   if [ "$MODULES_REDIRECT_OUTPUT" = '1' ]; then
    |   ¦   ┆   _mlredir=1;
    |   ¦   fi;
    |   fi;
    fi; 
    case " $@ " in 
    |   *' --no-redirect '*)
    |   ¦   _mlredir=0
    |   ;;  
    |   *' --redirect '*)
    |   ¦   _mlredir=1
    |   ;;
    esac;
    if [ $_mlredir -eq 0 ]; then
    |   _module_raw "$@";
    else
    |   _module_raw "$@" 2>&1;
    fi
}

Module command cannot be found in module shell function definition:

  • starting version 5.1.0: module command is always called from _module_raw shell function
  • starting version 4.0: module command is called from _module_raw shell function when it has been initialized in an interactive shell session
@xdelaruelle
Copy link
Contributor Author

Defining a specific check_module_function function in EnvironmentModules class should be able to fix this issue.

I will provide such fix that tests _module_raw shell function prior module shell function.

xdelaruelle added a commit to xdelaruelle/easybuild-framework that referenced this issue Oct 29, 2023
Default check_module_function tests that module command is called from
module shell function. With EnvironmentModules v4+, module command is
usually called from the _module_raw shell function.

This commit adds a specific version of check_module_function for
EnvironmentModules class. Module command is first checked within
_module_raw shell function definition. If not found, default test (that
checks module function) is run.

Adapt "test_module_mismatch" unit test to specifically check module
command definition with EnvironmentModules.

Fixes easybuilders#4368
@boegel boegel added this to the release after 4.8.2 milestone Oct 29, 2023
xdelaruelle added a commit to xdelaruelle/easybuild-framework that referenced this issue Oct 29, 2023
Default check_module_function tests that module command is called from
module shell function. With EnvironmentModules v4+, module command is
usually called from the _module_raw shell function.

This commit adds a specific version of check_module_function for
EnvironmentModules class. Module command is first checked within
_module_raw shell function definition. If not found, default test (that
checks module function) is run.

Add new unit test "test_environment_modules_specific" to specifically
check module command definition with EnvironmentModules.

Fixes easybuilders#4368
xdelaruelle added a commit to xdelaruelle/easybuild-framework that referenced this issue Nov 8, 2023
Default check_module_function tests that module command is called from
module shell function. With EnvironmentModules v4+, module command is
usually called from the _module_raw shell function.

This commit adds a specific version of check_module_function for
EnvironmentModules class. Module command is first checked within
_module_raw shell function definition. If not found, default test (that
checks module function) is run.

Add new unit test "test_environment_modules_specific" to specifically
check module command definition with EnvironmentModules.

Fixes easybuilders#4368
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants