Skip to content

Commit 58277ab

Browse files
committed
script to list broken modules
1 parent 062b624 commit 58277ab

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

modules/module_check.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/bash
2+
# Start interactive shell to access EESSI through build container
3+
# mkdir -p /tmp/$USER/EESSI
4+
# cd /tmp/$USER/EESSI
5+
# git clone https://github.com/EESSI/software-layer
6+
# cd software-layer
7+
# ./eessi_container.sh
8+
9+
# Initialize EESSI + load/configure EasyBuild
10+
# source /cvmfs/software.eessi.io/versions/2023.06/init/bash
11+
# module load EasyBuild/4.9.2
12+
# export WORKDIR=/tmp/$USER/EESSI
13+
# source configure_easybuild
14+
15+
# .eb directory as an argument
16+
if [ -z "$1" ]; then
17+
echo "Usage: $0 <directory>"
18+
exit 1
19+
fi
20+
21+
base_dir="$1"
22+
23+
# Dir where the modules will be
24+
module_install_dir="/tmp/$USER/EESSI/module-only"
25+
26+
locks_dir="/tmp/$USER/EESSI/locks"
27+
28+
# Log file to record broken modules
29+
broken_modules_log="broken_modules.log"
30+
> $broken_modules_log
31+
32+
declare -A checked_modules
33+
34+
# Locate all .eb files within the base dir
35+
easyconfig_files=$(find $base_dir -name "*.eb")
36+
37+
# Iterate over all eb files found. Package name based on eb file name
38+
for easyconfig_file in $easyconfig_files; do
39+
package_name=$(basename $easyconfig_file .eb)
40+
41+
# Run EB to generate the modules. Check if the eb command failed.
42+
echo "Generating modules for $package_name using EasyBuild..."
43+
eb $easyconfig_file --module-only --installpath-modules $module_install_dir --locks-dir $locks_dir --force --robot
44+
if [ $? -ne 0 ]; then
45+
echo "EasyBuild command failed for $package_name. Skipping..."
46+
echo "$package_name: EasyBuild command failed" >> $broken_modules_log
47+
continue
48+
fi
49+
50+
# Check the generated modules and iterate over the modules in the 'all' dir
51+
echo "Checking generated modules for $package_name..."
52+
for module_category in $(ls $module_install_dir/all); do
53+
for module_version in $(ls $module_install_dir/all/$module_category); do
54+
module_name="$module_category/$module_version"
55+
56+
# Checks if the module has already been tested
57+
if [ -n "${checked_modules[$module_name]}" ]; then
58+
echo "Module $module_name already checked. Skipping."
59+
continue
60+
fi
61+
62+
echo "Testing module: $module_name"
63+
64+
# Try loading the module
65+
if module --ignore_cache load $module_name 2>/dev/null; then
66+
echo "$module_name loaded successfully."
67+
module unload $module_name
68+
else
69+
echo "$module_name is broken."
70+
echo "$package_name: $module_name" >> $broken_modules_log
71+
fi
72+
73+
checked_modules[$module_name]=1
74+
done
75+
done
76+
done
77+
78+
echo "All module checks completed. Broken modules are listed in $broken_modules_log"
79+

0 commit comments

Comments
 (0)