Skip to content
Merged
Changes from all 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
18 changes: 8 additions & 10 deletions eb_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,10 @@ def post_ready_hook(self, *args, **kwargs):
Post-ready hook: limit parallellism for selected builds based on software name and CPU target.
parallelism needs to be limited because some builds require a lot of memory per used core.
"""
# 'parallel' (EB4) or 'max_parallel' (EB5) easyconfig parameter is set via EasyBlock.set_parallel in ready step
# based on available cores.

# Check whether we have EasyBuild 4 or 5
parallel_param = 'parallel'
if EASYBUILD_VERSION >= '5':
parallel_param = 'max_parallel'
# get current parallelism setting
parallel = self.cfg[parallel_param]
# 'parallel' easyconfig parameter (EB4) or the parallel property (EB5) is set via EasyBlock.set_parallel
# in ready step based on available cores
parallel = getattr(self, 'parallel', self.cfg['parallel'])

if parallel == 1:
return # no need to limit if already using 1 core

Expand Down Expand Up @@ -167,7 +162,10 @@ def post_ready_hook(self, *args, **kwargs):

# apply the limit if it's different from current
if new_parallel != parallel:
self.cfg[parallel_param] = new_parallel
if EASYBUILD_VERSION >= '5':
self.cfg.parallel = new_parallel
else:
self.cfg['parallel'] = new_parallel
msg = "limiting parallelism to %s (was %s) for %s on %s to avoid out-of-memory failures during building/testing"
print_msg(msg % (new_parallel, parallel, self.name, cpu_target), log=self.log)

Expand Down