Skip to content

Commit 715f08c

Browse files
authored
Merge pull request #3734 from Flamefire/timing2
Add per-extension timing
2 parents 0047019 + 3abbd19 commit 715f08c

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

easybuild/framework/easyblock.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2418,6 +2418,7 @@ def extensions_step(self, fetch=False, install=True):
24182418

24192419
tup = (ext.name, ext.version or '', idx + 1, exts_cnt)
24202420
print_msg("installing extension %s %s (%d/%d)..." % tup, silent=self.silent)
2421+
start_time = datetime.now()
24212422

24222423
if self.dry_run:
24232424
tup = (ext.name, ext.version, ext.__class__.__name__)
@@ -2438,11 +2439,19 @@ def extensions_step(self, fetch=False, install=True):
24382439

24392440
# real work
24402441
if install:
2441-
ext.prerun()
2442-
txt = ext.run()
2443-
if txt:
2444-
self.module_extra_extensions += txt
2445-
ext.postrun()
2442+
try:
2443+
ext.prerun()
2444+
txt = ext.run()
2445+
if txt:
2446+
self.module_extra_extensions += txt
2447+
ext.postrun()
2448+
finally:
2449+
if not self.dry_run:
2450+
ext_duration = datetime.now() - start_time
2451+
if ext_duration.total_seconds() >= 1:
2452+
print_msg("\t... (took %s)", time2str(ext_duration), log=self.log, silent=self.silent)
2453+
elif self.logdebug or build_option('trace'):
2454+
print_msg("\t... (took < 1 sec)", log=self.log, silent=self.silent)
24462455

24472456
# cleanup (unload fake module, remove fake module dir)
24482457
if fake_mod_data:

0 commit comments

Comments
 (0)