-
Notifications
You must be signed in to change notification settings - Fork 254
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modifications to allow workflow to run to completion with GNU build o…
…n Hera (#526) * Modifications to scripts to allow the workflow to run to completion with the GNU build on Hera. The python/miniconda3 module must be unloaded prior to running the executable. * "module" is not the best name for a variable, changed to a_module * Address comments: - Clarify message about why modules are being unloaded - Remove print message if nothing is unloaded to reduce clutter in log file - Rename "module_to_unload" to "modules_to_unload" - Change "a_module" to "module_to_unload" for clarity * Clarify purpose of the unload_python.sh function. * Add the "why"
- Loading branch information
JulieSchramm
authored
Jul 21, 2021
1 parent
f5f5003
commit 19a872b
Showing
5 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# This file defines a function that detects if a python or miniconds3 | ||
# module is loaded, and if so, unloads that module. This may be | ||
# necessary on machines where the loaded python environment isn't | ||
# compatible with environment set for the compiler. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
function unload_python() { | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Save current shell options (in a global array). Then set new options | ||
# for this script/function. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
{ save_shell_opts; set -u +x; } > /dev/null 2>&1 | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Get the full path to the file in which this script/function is located | ||
# (scrfunc_fp), the name of that file (scrfunc_fn), and the directory in | ||
# which the file is located (scrfunc_dir). | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
local scrfunc_fp=$( readlink -f "${BASH_SOURCE[0]}" ) | ||
local scrfunc_fn=$( basename "${scrfunc_fp}" ) | ||
local scrfunc_dir=$( dirname "${scrfunc_fp}" ) | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Get the name of this function. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
local func_name="${FUNCNAME[0]}" | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Check arguments. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
if [ "$#" -ne 0 ]; then | ||
|
||
print_err_msg_exit " | ||
Incorrect number of arguments specified: | ||
Function name: \"${func_name}\" | ||
Number of arguments specified: $# | ||
Usage: | ||
${func_name} | ||
" | ||
|
||
fi | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# If the miniconda or python modules are loaded, unload them | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
|
||
modules_to_unload=( python miniconda3 ) | ||
loaded_modules=$(module list 2>&1) | ||
|
||
for module_to_unload in ${modules_to_unload[@]}; do | ||
if [[ "${loaded_modules}" =~ "${module_to_unload}" ]]; then | ||
print_info_msg "\ | ||
Unloading module ${module_to_unload} libraries needed for workflow generation but not for running the workflow... " | ||
module unload ${module_to_unload} | ||
fi | ||
done | ||
|
||
loaded_modules=$(module list 2>&1) | ||
print_info_msg "\ | ||
Loaded modules are: $loaded_modules " | ||
|
||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Restore the shell options saved at the beginning of this script/func- | ||
# tion. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
{ restore_shell_opts; } > /dev/null 2>&1 | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters