Skip to content

Commit a0bd30c

Browse files
authored
Merge pull request #1 from ocaisa/remove_max_parallel
Also address EESSI/software-layer#1104
2 parents 59aeaf5 + cacee7c commit a0bd30c

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

eb_hooks.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,10 @@ def post_ready_hook(self, *args, **kwargs):
128128
Post-ready hook: limit parallellism for selected builds based on software name and CPU target.
129129
parallelism needs to be limited because some builds require a lot of memory per used core.
130130
"""
131-
# 'parallel' (EB4) or 'max_parallel' (EB5) easyconfig parameter is set via EasyBlock.set_parallel in ready step
132-
# based on available cores.
133-
134-
# Check whether we have EasyBuild 4 or 5
135-
parallel_param = 'parallel'
136-
if EASYBUILD_VERSION >= '5':
137-
parallel_param = 'max_parallel'
138-
# get current parallelism setting
139-
parallel = self.cfg[parallel_param]
131+
# 'parallel' easyconfig parameter (EB4) or the parallel property (EB5) is set via EasyBlock.set_parallel
132+
# in ready step based on available cores
133+
parallel = getattr(self, 'parallel', self.cfg['parallel'])
134+
140135
if parallel == 1:
141136
return # no need to limit if already using 1 core
142137

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

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

0 commit comments

Comments
 (0)