Skip to content

Commit 9cd535c

Browse files
committed
Merge branch 'develop' into 5.0.x
2 parents 09609b7 + a0f8b99 commit 9cd535c

File tree

5 files changed

+76
-15
lines changed

5 files changed

+76
-15
lines changed

.github/workflows/end2end.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,17 @@ jobs:
1717
fail-fast: false
1818
container:
1919
image: ghcr.io/easybuilders/${{ matrix.container }}-amd64
20-
env: {ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true} # Allow using Node16 actions
20+
volumes:
21+
- /node20217:/node20217:rw,rshared
22+
- ${{ matrix.container == 'centos-7.9' && '/node20217:/__e/node20:ro,rshared' || ' ' }}
2123
steps:
24+
- name: install nodejs20glibc2.17
25+
if: ${{ matrix.container == 'centos-7.9' }}
26+
run: |
27+
curl -LO https://unofficial-builds.nodejs.org/download/release/v20.9.0/node-v20.9.0-linux-x64-glibc-217.tar.xz
28+
tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217
2229
- name: Check out the repo
23-
uses: actions/checkout@v3
30+
uses: actions/checkout@v4
2431

2532
- name: download and unpack easyblocks and easyconfigs repositories
2633
run: |

.github/workflows/unit_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ jobs:
197197
IGNORE_PATTERNS+="|skipping SvnRepository test"
198198
IGNORE_PATTERNS+="|requires Lmod as modules tool"
199199
IGNORE_PATTERNS+="|stty: 'standard input': Inappropriate ioctl for device"
200-
IGNORE_PATTERNS+="|CryptographyDeprecationWarning: Python 3.[56]"
200+
IGNORE_PATTERNS+="|CryptographyDeprecationWarning: Python 3.[567]"
201201
IGNORE_PATTERNS+="|from cryptography.* import "
202202
IGNORE_PATTERNS+="|CryptographyDeprecationWarning: Python 2"
203203
IGNORE_PATTERNS+="|Blowfish"

easybuild/framework/easyblock.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
* Maxime Boissonneault (Compute Canada)
4141
* Davide Vanzo (Vanderbilt University)
4242
* Caspar van Leeuwen (SURF)
43+
* Jan Andre Reuter (Juelich Supercomputing Centre)
4344
"""
4445
import concurrent
4546
import copy
@@ -143,10 +144,11 @@ def extra_options(extra=None):
143144
#
144145
# INIT
145146
#
146-
def __init__(self, ec):
147+
def __init__(self, ec, logfile=None):
147148
"""
148149
Initialize the EasyBlock instance.
149150
:param ec: a parsed easyconfig file (EasyConfig instance)
151+
:param logfile: pass logfile from other EasyBlock. If not passed, create logfile (optional)
150152
"""
151153

152154
# keep track of original working directory, so we can go back there
@@ -216,7 +218,8 @@ def __init__(self, ec):
216218

217219
# logging
218220
self.log = None
219-
self.logfile = None
221+
self.logfile = logfile
222+
self.external_logfile = logfile is not None
220223
self.logdebug = build_option('debug')
221224
self.postmsg = '' # allow a post message to be set, which can be shown as last output
222225
self.current_step = None
@@ -305,11 +308,11 @@ def _init_log(self):
305308
if self.log is not None:
306309
return
307310

308-
self.logfile = get_log_filename(self.name, self.version, add_salt=True)
309-
fancylogger.logToFile(self.logfile, max_bytes=0)
311+
if self.logfile is None:
312+
self.logfile = get_log_filename(self.name, self.version, add_salt=True)
313+
fancylogger.logToFile(self.logfile, max_bytes=0)
310314

311315
self.log = fancylogger.getLogger(name=self.__class__.__name__, fname=False)
312-
313316
self.log.info(this_is_easybuild())
314317

315318
this_module = inspect.getmodule(self)
@@ -325,6 +328,9 @@ def close_log(self):
325328
"""
326329
Shutdown the logger.
327330
"""
331+
# only close log if we created a logfile
332+
if self.external_logfile:
333+
return
328334
self.log.info("Closing log for application name %s version %s" % (self.name, self.version))
329335
fancylogger.logToFile(self.logfile, enable=False)
330336

easybuild/scripts/findUpdatedEcs.sh

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ YELLOW='\033[0;33m'
88
NC='\033[0m'
99

1010
function printError {
11-
echo -e "${RED}$@${NC}"
11+
echo -e "${RED}$*${NC}"
1212
}
1313

1414
verbose=0
@@ -23,11 +23,11 @@ function checkModule {
2323
moduleStr="$moduleName/$moduleVersion"
2424
printVerbose "Processing $moduleStr"
2525
ec_glob=( "$moduleFolder/easybuild/"*.eb )
26-
if [[ ! -e "${ec_glob[@]}" ]]; then
26+
if [[ ! -e "${ec_glob[0]}" ]]; then
2727
printError "=== Did not find installed EC for $moduleStr"
2828
return
2929
fi
30-
ec_installed="$ec_glob"
30+
ec_installed="${ec_glob[0]}"
3131
ec_filename=$(basename "$ec_installed")
3232
# Try with most likely location first for speed
3333
first_letter=${ec_filename:0:1}
@@ -67,15 +67,15 @@ if path=$(which eb 2>/dev/null); then
6767
fi
6868

6969
function usage {
70-
echo "Usage: $(basename "$0") [--verbose] [--diff] --loaded|--modules INSTALLPATH --easyconfigs EC-FOLDER"
70+
echo "Usage: $(basename "$0") [--verbose] [--short] [--diff] --loaded|--modules INSTALLPATH --easyconfigs EC-FOLDER"
7171
echo
7272
echo "Check installed modules against the source EasyConfig (EC) files to determine which have changed."
7373
echo "Can either check the currently loaded modules or all modules installed in a specific location"
7474
echo
7575
echo "--verbose Verbose status output while checking"
76-
echo "--loaded Check only currently loaded modules"
7776
echo "--short Only show filename of changed ECs"
7877
echo "--diff Show diff of changed module files"
78+
echo "--loaded Check only currently loaded modules"
7979
echo "--modules INSTALLPATH Check all modules in the specified (software) installpath, i.e. the root of module-binaries"
8080
echo "--easyconfigs EC-FOLDER Path to the folder containg the current/updated EasyConfigs. ${ecDefaultFolder:+Defaults to $ecDefaultFolder}"
8181
exit 0
@@ -115,6 +115,7 @@ done
115115
if [ -z "$easyconfigFolder" ]; then
116116
printError "Folder to easyconfigs not given!" && exit 1
117117
fi
118+
118119
if [ -z "$modulesFolder" ]; then
119120
if (( checkLoadedModules == 0 )); then
120121
printError "Need either --modules or --loaded to specify what to check!" && exit 1
@@ -123,13 +124,18 @@ elif (( checkLoadedModules == 1 )); then
123124
printError "Cannot specify --modules and --loaded!" && exit 1
124125
fi
125126

127+
if (( showDiff == 1 && short == 1 )); then
128+
printError "Cannot specify --diff and --short" && exit 1
129+
fi
130+
126131
if [ -d "$easyconfigFolder/easybuild/easyconfigs" ]; then
127132
easyconfigFolder="$easyconfigFolder/easybuild/easyconfigs"
128133
fi
129134

130135
if (( checkLoadedModules == 1 )); then
131-
for varname in $(compgen -A variable | grep '^EBROOT'); do
132-
checkModule "${!varname}"
136+
IFS=$'\n' read -r -d '' -a unique_module_paths <<< "$(for varname in $(compgen -A variable | grep '^EBROOT'); do echo "${!varname}"; done | sort -u )" || true
137+
for module in "${unique_module_paths[@]}"; do
138+
checkModule "$module"
133139
done
134140
else
135141
for module in "$modulesFolder"/*/*/easybuild; do

test/framework/easyblock.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
@author: Jens Timmerman (Ghent University)
2929
@author: Kenneth Hoste (Ghent University)
3030
@author: Maxime Boissonneault (Compute Canada)
31+
@author: Jan Andre Reuter (Juelich Supercomputing Centre)
3132
"""
3233
import os
3334
import re
@@ -2994,6 +2995,47 @@ def run_sanity_check_step(sanity_check_paths, enhance_sanity_check):
29942995
run_sanity_check_step({}, False)
29952996
run_sanity_check_step({}, True)
29962997

2998+
def test_create_easyblock_without_logfile(self):
2999+
"""
3000+
Test creating an EasyBlock without a logfile.
3001+
This represents scenarios found in Bundle and QuantumESPRESSO, where an EasyBlock is
3002+
created within another EasyBlock.
3003+
"""
3004+
self.contents = '\n'.join([
3005+
'easyblock = "ConfigureMake"',
3006+
'name = "pi"',
3007+
'version = "3.14"',
3008+
'homepage = "http://example.com"',
3009+
'description = "test easyconfig"',
3010+
'toolchain = SYSTEM',
3011+
])
3012+
self.writeEC()
3013+
# Ensure that the default case works as expected
3014+
eb = EasyBlock(EasyConfig(self.eb_file))
3015+
self.assertNotEqual(eb.log, None)
3016+
self.assertNotEqual(eb.logfile, None)
3017+
# Get reference to the actual log instance and ensure that it works
3018+
# This is NOT eb.log, which represents a separate logger with a separate name.
3019+
file_log = fancylogger.getLogger(name=None)
3020+
self.assertNotEqual(getattr(file_log, 'logtofile_%s' % eb.logfile), False)
3021+
3022+
# Now, create another EasyBlock by passing logfile from first EasyBlock.
3023+
eb_external_logfile = EasyBlock(EasyConfig(self.eb_file), logfile=eb.logfile)
3024+
self.assertNotEqual(eb_external_logfile.log, None)
3025+
self.assertTrue(eb_external_logfile.external_logfile)
3026+
self.assertEqual(eb_external_logfile.logfile, eb.logfile)
3027+
# Try to log something in it.
3028+
eb_external_logfile.log.info("Test message")
3029+
3030+
# Try to close EasyBlock with external logfile. This should not affect the logger.
3031+
eb_external_logfile.close_log()
3032+
self.assertNotEqual(getattr(file_log, 'logtofile_%s' % eb.logfile), False)
3033+
# Then close the log from creating EasyBlock. This should work as expected.
3034+
eb.close_log()
3035+
self.assertEqual(getattr(file_log, 'logtofile_%s' % eb.logfile), False)
3036+
3037+
os.remove(eb.logfile)
3038+
29973039

29983040
def suite():
29993041
""" return all the tests in this file """

0 commit comments

Comments
 (0)