Skip to content

Commit

Permalink
also update extensions progress bar when installing extensions in par…
Browse files Browse the repository at this point in the history
…allel
  • Loading branch information
boegel committed Oct 21, 2021
1 parent a1cf735 commit 6053c0c
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1733,6 +1733,21 @@ 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)
if running_exts_cnt > 1:
progress_label = "Installing %d extensions: " % running_exts_cnt
elif running_exts_cnt == 1:
progress_label = "Installing extension "
else:
progress_label = "Not installing extensions (yet)"

progress_label += ' '.join(e.name for e in running_exts)
update_progress_bar(PROGRESS_BAR_EXTENSIONS, label=progress_label, progress_size=progress_size)

iter_id = 0
while exts_queue or running_exts:

Expand All @@ -1750,6 +1765,7 @@ def install_extensions_parallel(self, install=True):
ext.postrun()
running_exts.remove(ext)
installed_ext_names.append(ext.name)
update_exts_progress_bar(running_exts, 1)
else:
self.log.debug("Installation of %s is still running...", ext.name)

Expand Down Expand Up @@ -1811,7 +1827,10 @@ def install_extensions_parallel(self, install=True):
ext.prerun()
ext.run(asynchronous=True)
running_exts.append(ext)
self.log.debug("Started installation of extension %s in the background...", ext.name)
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

0 comments on commit 6053c0c

Please sign in to comment.