Skip to content

Commit faf0720

Browse files
committed
generate fake modules for each extension installed instead of a single fake module for the whole extenions installation step
1 parent 26d1d56 commit faf0720

File tree

1 file changed

+23
-35
lines changed

1 file changed

+23
-35
lines changed

easybuild/framework/easyblock.py

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,20 +2108,21 @@ def install_extensions_sequential(self, install=True):
21082108

21092109
# actual installation of the extension
21102110
if install:
2111-
try:
2112-
ext.install_extension_substep("pre_install_extension")
2113-
with self.module_generator.start_module_creation():
2114-
txt = ext.install_extension_substep("install_extension")
2115-
if txt:
2116-
self.module_extra_extensions += txt
2117-
ext.install_extension_substep("post_install_extension")
2118-
finally:
2119-
if not self.dry_run:
2120-
ext_duration = datetime.now() - start_time
2121-
if ext_duration.total_seconds() >= 1:
2122-
print_msg("\t... (took %s)", time2str(ext_duration), log=self.log, silent=self.silent)
2123-
elif self.logdebug or build_option('trace'):
2124-
print_msg("\t... (took < 1 sec)", log=self.log, silent=self.silent)
2111+
with self.fake_module_environment():
2112+
try:
2113+
ext.install_extension_substep("pre_install_extension")
2114+
with self.module_generator.start_module_creation():
2115+
txt = ext.install_extension_substep("install_extension")
2116+
if txt:
2117+
self.module_extra_extensions += txt
2118+
ext.install_extension_substep("post_install_extension")
2119+
finally:
2120+
if not self.dry_run:
2121+
ext_duration = datetime.now() - start_time
2122+
if ext_duration.total_seconds() >= 1:
2123+
print_msg("\t... (took %s)", time2str(ext_duration), log=self.log, silent=self.silent)
2124+
elif self.logdebug or build_option('trace'):
2125+
print_msg("\t... (took < 1 sec)", log=self.log, silent=self.silent)
21252126

21262127
self.update_exts_progress_bar(progress_info, progress_size=1)
21272128

@@ -2268,10 +2269,11 @@ def update_exts_progress_bar_helper(running_exts, progress_size):
22682269
ext.toolchain.prepare(onlymod=self.cfg['onlytcmod'], silent=True, loadmod=False,
22692270
rpath_filter_dirs=self.rpath_filter_dirs)
22702271
if install:
2271-
ext.install_extension_substep("pre_install_extension")
2272-
ext.async_cmd_task = ext.install_extension_substep("install_extension_async", thread_pool)
2273-
running_exts.append(ext)
2274-
self.log.info(f"Started installation of extension {ext.name} in the background...")
2272+
with self.fake_module_environment():
2273+
ext.install_extension_substep("pre_install_extension")
2274+
ext.async_cmd_task = ext.install_extension_substep("install_extension_async", thread_pool)
2275+
running_exts.append(ext)
2276+
self.log.info(f"Started installation of extension {ext.name} in the background...")
22752277
update_exts_progress_bar_helper(running_exts, 0)
22762278

22772279
# print progress info after every iteration (unless that info is already shown via progress bar)
@@ -3109,14 +3111,9 @@ def extensions_step(self, fetch=False, install=True):
31093111
self.log.debug("No extensions in exts_list")
31103112
return
31113113

3112-
# load fake module
3113-
fake_mod_data = None
3114-
if install and not self.dry_run:
3115-
3116-
# load modules for build dependencies as extra modules
3117-
build_dep_mods = [dep['short_mod_name'] for dep in self.cfg.dependencies(build_only=True)]
3118-
3119-
fake_mod_data = self.load_fake_module(purge=True, extra_modules=build_dep_mods)
3114+
# we really need a default class
3115+
if not self.cfg['exts_defaultclass'] and install:
3116+
raise EasyBuildError("ERROR: No default extension class set for %s", self.name)
31203117

31213118
start_progress_bar(PROGRESS_BAR_EXTENSIONS, len(self.cfg.get_ref('exts_list')))
31223119

@@ -3132,22 +3129,13 @@ def extensions_step(self, fetch=False, install=True):
31323129
if install:
31333130
self.log.info("Installing extensions")
31343131

3135-
# we really need a default class
3136-
if not self.cfg['exts_defaultclass'] and fake_mod_data:
3137-
self.clean_up_fake_module(fake_mod_data)
3138-
raise EasyBuildError("ERROR: No default extension class set for %s", self.name)
3139-
31403132
self.init_ext_instances()
31413133

31423134
if self.skip:
31433135
self.skip_extensions()
31443136

31453137
self.install_all_extensions(install=install)
31463138

3147-
# cleanup (unload fake module, remove fake module dir)
3148-
if fake_mod_data:
3149-
self.clean_up_fake_module(fake_mod_data)
3150-
31513139
stop_progress_bar(PROGRESS_BAR_EXTENSIONS, visible=False)
31523140

31533141
def package_step(self):

0 commit comments

Comments
 (0)