Skip to content

Commit 3abbd19

Browse files
committed
Add per-extension timing
1 parent 544061e commit 3abbd19

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
@@ -2366,6 +2366,7 @@ def extensions_step(self, fetch=False, install=True):
23662366

23672367
tup = (ext.name, ext.version or '', idx + 1, exts_cnt)
23682368
print_msg("installing extension %s %s (%d/%d)..." % tup, silent=self.silent)
2369+
start_time = datetime.now()
23692370

23702371
if self.dry_run:
23712372
tup = (ext.name, ext.version, ext.__class__.__name__)
@@ -2386,11 +2387,19 @@ def extensions_step(self, fetch=False, install=True):
23862387

23872388
# real work
23882389
if install:
2389-
ext.prerun()
2390-
txt = ext.run()
2391-
if txt:
2392-
self.module_extra_extensions += txt
2393-
ext.postrun()
2390+
try:
2391+
ext.prerun()
2392+
txt = ext.run()
2393+
if txt:
2394+
self.module_extra_extensions += txt
2395+
ext.postrun()
2396+
finally:
2397+
if not self.dry_run:
2398+
ext_duration = datetime.now() - start_time
2399+
if ext_duration.total_seconds() >= 1:
2400+
print_msg("\t... (took %s)", time2str(ext_duration), log=self.log, silent=self.silent)
2401+
elif self.logdebug or build_option('trace'):
2402+
print_msg("\t... (took < 1 sec)", log=self.log, silent=self.silent)
23942403

23952404
# cleanup (unload fake module, remove fake module dir)
23962405
if fake_mod_data:

0 commit comments

Comments
 (0)