Skip to content

Commit 48ea737

Browse files
committed
Fix handling of (max_)parallel for extensions
When copying an EC we need to copy the parallel property too. When instantiating an extension we need to check the `max_parallel` again in case it was set in the extension options.
1 parent 3ad6aa5 commit 48ea737

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

easybuild/framework/easyblock.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2422,7 +2422,7 @@ def set_parallel(self):
24222422
else:
24232423
par = min(int(par), int(cfg_par))
24242424

2425-
par = det_parallelism(par, maxpar=self.cfg['maxparallel'])
2425+
par = det_parallelism(par, maxpar=self.cfg['max_parallel'])
24262426
self.log.info("Setting parallelism: %s" % par)
24272427
self.cfg.parallel = par
24282428

easybuild/framework/easyconfig/easyconfig.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ def copy(self, validate=None):
615615
ec = EasyConfig(self.path, validate=validate, hidden=self.hidden, rawtxt=self.rawtxt)
616616
# take a copy of the actual config dictionary (which already contains the extra options)
617617
ec._config = copy.deepcopy(self._config)
618+
ec._parallel = self._parallel # Might be already set, e.g. for extensions
618619
# since rawtxt is defined, self.path may not get inherited, make sure it does
619620
if self.path:
620621
ec.path = self.path
@@ -721,7 +722,7 @@ def parse(self):
721722

722723
if 'parallel' in ec_vars:
723724
# Replace value and issue better warning for EC params (as opposed to warnings meant for easyblocks)
724-
self.log.deprecated("Easyconfig parameter 'parallel' is deprecated, use 'maxparallel' instead.", '5.1')
725+
self.log.deprecated("Easyconfig parameter 'parallel' is deprecated, use 'max_parallel' instead.", '5.1')
725726
ec_vars['_parallelLegacy'] = ec_vars.pop('parallel')
726727

727728
# provide suggestions for typos. Local variable names are excluded from this check

easybuild/framework/extension.py

+9
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ def __init__(self, mself, ext, extra_params=None):
132132
self.options = resolve_template(copy.deepcopy(self.ext.get('options', {})),
133133
self.cfg.template_values,
134134
expect_resolved=False)
135+
if 'parallel' in self.options:
136+
# Replace value and issue better warning for EC params (as opposed to warnings meant for easyblocks)
137+
self.log.deprecated("Easyconfig parameter 'parallel' is deprecated, use 'max_parallel' instead.", '5.1')
138+
self.options['max_parallel'] = self.options.pop('parallel')
135139

136140
if extra_params:
137141
self.cfg.extend_params(extra_params, overwrite=False)
@@ -149,6 +153,11 @@ def __init__(self, mself, ext, extra_params=None):
149153
self.log.debug("Skipping unknown custom easyconfig parameter '%s' for extension %s/%s: %s",
150154
key, name, version, value)
151155

156+
# Take potentially new value into account
157+
max_par = self.cfg['max_parallel']
158+
if max_par is not None and max_par < self.cfg.parallel:
159+
self.cfg.parallel = max_par
160+
152161
self.sanity_check_fail_msgs = []
153162
self.sanity_check_module_loaded = False
154163
self.fake_mod_data = None

0 commit comments

Comments
 (0)