Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-32658: Only do getmodule if we know the log message will be issued #105

Merged
merged 3 commits into from Nov 20, 2021

Conversation

timj
Copy link
Member

@timj timj commented Nov 19, 2021

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes

@timj timj requested a review from TallJimbo November 19, 2021 16:57
@codecov
Copy link

codecov bot commented Nov 19, 2021

Codecov Report

Merging #105 (bfa336a) into master (426b06a) will increase coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #105      +/-   ##
==========================================
+ Coverage   90.90%   91.01%   +0.11%     
==========================================
  Files          36       36              
  Lines        2110     2136      +26     
==========================================
+ Hits         1918     1944      +26     
  Misses        192      192              
Impacted Files Coverage Δ
python/lsst/utils/timer.py 95.32% <100.00%> (+0.32%) ⬆️
tests/test_timer.py 99.31% <100.00%> (+0.10%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 426b06a...bfa336a. Read the comment docs.

@timj
Copy link
Member Author

timj commented Nov 19, 2021

Actually, @ktlim would like me to try the decorator approach to remove the getmodule overhead from runtime.

@timj
Copy link
Member Author

timj commented Nov 19, 2021

I've updated the PR to pass the stacklevel from timeMethod and through logInfo to logPairs. This should remove the need for getmodule completely.

python/lsst/utils/timer.py Show resolved Hide resolved
python/lsst/utils/timer.py Show resolved Hide resolved
This allows timeMethod to pass the stacklevel directly through
to logInfo, bypassing the need for getmodule to be called at all.
In a profile it comes up as generic "wrapper" so rename it
to timeMethod_wrapper makes it easier to find.
@timj timj merged commit 2a5a563 into master Nov 20, 2021
@timj timj deleted the tickets/DM-32658 branch November 20, 2021 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants