Skip to content

Commit 3dcb0af

Browse files
committed
Fix errors due to parallel property being unset
Move `set_parallel` to `post_init` which matches better than the `ready_step`. That is described: > creating build dir, resetting environment > Verify if all is ok to start build. None of that matches the behavior of a `set_parallel` call as opposed to > Run post-initialization tasks. When handling potentially additional limitations in extensions we need to check if we have `parallel` set already before applying it. This should only be the case for tests which take shortcuts in the logic such as skipping `post_init`.
1 parent 48ea737 commit 3dcb0af

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

easybuild/framework/easyblock.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ def post_init(self):
340340
# but needs to be correct if the build is performed in the installation directory
341341
self.log.info("Changing build dir to %s", self.installdir)
342342
self.builddir = self.installdir
343+
self.set_parallel()
343344

344345
# INIT/CLOSE LOG
345346
def _init_log(self):
@@ -2470,8 +2471,6 @@ def check_readiness_step(self):
24702471
"""
24712472
Verify if all is ok to start build.
24722473
"""
2473-
self.set_parallel()
2474-
24752474
# check whether modules are loaded
24762475
loadedmods = self.modules_tool.loaded_modules()
24772476
if len(loadedmods) > 0:

easybuild/framework/easyconfig/easyconfig.py

+5
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,11 @@ def all_dependencies(self):
12581258

12591259
return self._all_dependencies
12601260

1261+
@property
1262+
def is_parallel_set(self):
1263+
"""Return if the desired parallelism has been determined yet"""
1264+
return self._parallel is not None
1265+
12611266
@property
12621267
def parallel(self):
12631268
"""Number of parallel jobs to be used for building etc."""

easybuild/framework/extension.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,11 @@ def __init__(self, mself, ext, extra_params=None):
153153
self.log.debug("Skipping unknown custom easyconfig parameter '%s' for extension %s/%s: %s",
154154
key, name, version, value)
155155

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
156+
# If parallelism has been set already take potentially new limitation into account
157+
if self.cfg.is_parallel_set:
158+
max_par = self.cfg['max_parallel']
159+
if max_par is not None and max_par < self.cfg.parallel:
160+
self.cfg.parallel = max_par
160161

161162
self.sanity_check_fail_msgs = []
162163
self.sanity_check_module_loaded = False

0 commit comments

Comments
 (0)