Skip to content

don't call out to prohibitively expensive getRootLoggerName in getLogger, just use 'root' instead#3074

Merged
akesandgren merged 1 commit intoeasybuilders:developfrom
boegel:getLogger_fix
Nov 8, 2019
Merged

don't call out to prohibitively expensive getRootLoggerName in getLogger, just use 'root' instead#3074
akesandgren merged 1 commit intoeasybuilders:developfrom
boegel:getLogger_fix

Conversation

@boegel
Copy link
Copy Markdown
Member

@boegel boegel commented Nov 8, 2019

The calls to getRootLoggerName are very expensive when __debug__ is True, since then it relies heavily on Python's inspect module.

For some reason unclear to me, the easyconfig tests that run in GitHub CI with Python 3.6 and 3.7 trigger the path that corresponds with __debug__ being False, despite running under python -O (and also defining $PYTHONOPTIMIZE doesn't help).

Regardless, I think it's fine to strip out the call to getRootLoggerName and just use a fixed 'root' name instead.

For normal use of EasyBuild via the eb command, this doesn't make a difference (since then python -O is used under the covers, and the name of the root logger isn't actually visible anywhere by default unless the %(name)s template is used in the log format set via setLogFormat).

This minor change will significantly speed up the easyconfig tests though, when getRootLoggerName follows the path to inspect...

@boegel boegel added the change label Nov 8, 2019
@boegel boegel added this to the next release (4.0.2?) milestone Nov 8, 2019
Comment thread test/framework/build_log.py
Comment thread test/framework/build_log.py
@boegel
Copy link
Copy Markdown
Member Author

boegel commented Nov 8, 2019

Some more details: currently ~65% of the time running the easyconfig test suite in GitHub CI with Python 3.6 and 3.7 is spent in getRootLoggerName, so replacing the call with a hardcoded string value is going to result in cutting the test time in half (more even)...

@boegel
Copy link
Copy Markdown
Member Author

boegel commented Nov 8, 2019

close/re-open to wake up the Hound...

@boegel boegel closed this Nov 8, 2019
@boegel boegel reopened this Nov 8, 2019
Copy link
Copy Markdown
Contributor

@akesandgren akesandgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@akesandgren
Copy link
Copy Markdown
Contributor

Going in, thanks @boegel!

@akesandgren akesandgren merged commit 71fa3f9 into easybuilders:develop Nov 8, 2019
@boegel boegel deleted the getLogger_fix branch November 8, 2019 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants