Skip to content

Commit

Permalink
start extensions progress bar a bit earlier, also mention preparatory…
Browse files Browse the repository at this point in the history
… steps (like creating of Extension instances)
  • Loading branch information
boegel committed Oct 21, 2021
1 parent 3fe1f68 commit 2e5c6ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,6 @@ def install_extensions_sequential(self, install=True):
self.log.info("Installing extensions sequentially...")

exts_cnt = len(self.ext_instances)
start_progress_bar(PROGRESS_BAR_EXTENSIONS, exts_cnt)

for idx, ext in enumerate(self.ext_instances):

Expand All @@ -1670,7 +1669,7 @@ def install_extensions_sequential(self, install=True):
# always go back to original work dir to avoid running stuff from a dir that no longer exists
change_dir(self.orig_workdir)

progress_label = "Installing '%s' extension" % ext.name
progress_label = "Installing '%s' extension (%s/%s)" % (ext.name, idx + 1, exts_cnt)
update_progress_bar(PROGRESS_BAR_EXTENSIONS, label=progress_label)

tup = (ext.name, ext.version or '', idx + 1, exts_cnt)
Expand Down Expand Up @@ -1711,8 +1710,6 @@ def install_extensions_sequential(self, install=True):
elif self.logdebug or build_option('trace'):
print_msg("\t... (took < 1 sec)", log=self.log, silent=self.silent)

stop_progress_bar(PROGRESS_BAR_EXTENSIONS, visible=False)

def install_extensions_parallel(self, install=True):
"""
Install extensions in parallel.
Expand All @@ -1734,8 +1731,6 @@ def install_extensions_parallel(self, install=True):
exts_cnt = len(all_ext_names)
exts_queue = self.ext_instances[:]

start_progress_bar(PROGRESS_BAR_EXTENSIONS, exts_cnt)

def update_exts_progress_bar(running_exts, progress_size):
"""Helper function to update extensions progress bar."""
running_exts_cnt = len(running_exts)
Expand All @@ -1747,6 +1742,7 @@ def update_exts_progress_bar(running_exts, progress_size):
progress_label = "Not installing extensions (yet)"

progress_label += ' '.join(e.name for e in running_exts)
progress_label += "(%d/%d done)" % (len(installed_ext_names), exts_cnt)
update_progress_bar(PROGRESS_BAR_EXTENSIONS, label=progress_label, progress_size=progress_size)

iter_id = 0
Expand Down Expand Up @@ -1831,8 +1827,6 @@ def update_exts_progress_bar(running_exts, progress_size):
self.log.info("Started installation of extension %s in the background...", ext.name)
update_exts_progress_bar(running_exts, 0)

stop_progress_bar(PROGRESS_BAR_EXTENSIONS, visible=False)

#
# MISCELLANEOUS UTILITY FUNCTIONS
#
Expand Down Expand Up @@ -2587,9 +2581,12 @@ def extensions_step(self, fetch=False, install=True):

fake_mod_data = self.load_fake_module(purge=True, extra_modules=build_dep_mods)

start_progress_bar(PROGRESS_BAR_EXTENSIONS, len(self.cfg['exts_list']))

self.prepare_for_extensions()

if fetch:
update_progress_bar(PROGRESS_BAR_EXTENSIONS, label="fetching extension sources/patches", progress_size=0)
self.exts = self.collect_exts_file_info(fetch_files=True)

self.exts_all = self.exts[:] # retain a copy of all extensions, regardless of filtering/skipping
Expand All @@ -2603,9 +2600,11 @@ def extensions_step(self, fetch=False, install=True):
self.clean_up_fake_module(fake_mod_data)
raise EasyBuildError("ERROR: No default extension class set for %s", self.name)

update_progress_bar(PROGRESS_BAR_EXTENSIONS, label="creating Extension instances", progress_size=0)
self.init_ext_instances()

if self.skip:
update_progress_bar(PROGRESS_BAR_EXTENSIONS, label="skipping installed extensions", progress_size=0)
self.skip_extensions()

self.install_extensions(install=install)
Expand All @@ -2614,6 +2613,8 @@ def extensions_step(self, fetch=False, install=True):
if fake_mod_data:
self.clean_up_fake_module(fake_mod_data)

stop_progress_bar(PROGRESS_BAR_EXTENSIONS, visible=False)

def package_step(self):
"""Package installed software (e.g., into an RPM), if requested, using selected package tool."""

Expand Down
2 changes: 1 addition & 1 deletion easybuild/tools/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def extensions_progress_bar():
Get progress bar to show progress for installing extensions.
"""
progress_bar = Progress(
TextColumn("[bold blue]{task.description} ({task.completed}/{task.total})"),
TextColumn("[bold blue]{task.description}"),
BarColumn(),
TimeElapsedColumn(),
)
Expand Down

0 comments on commit 2e5c6ab

Please sign in to comment.