Use Python for sccache hit rate computation.#2474
Merged
AyodeAwe merged 1 commit intorapidsai:branch-24.12from Oct 21, 2024
Merged
Use Python for sccache hit rate computation.#2474AyodeAwe merged 1 commit intorapidsai:branch-24.12from
AyodeAwe merged 1 commit intorapidsai:branch-24.12from
Conversation
KyleFromNVIDIA
approved these changes
Oct 21, 2024
Member
KyleFromNVIDIA
left a comment
There was a problem hiding this comment.
One small suggestion, you can take it or leave it. I don't need to review again.
| COMPILE_REQUESTS=$(sccache -s | grep "Compile requests \+ [0-9]\+$" | awk '{ print $NF }') | ||
| CACHE_HITS=$(sccache -s | grep "Cache hits \+ [0-9]\+$" | awk '{ print $NF }') | ||
| HIT_RATE=$(echo - | awk "{printf \"%.2f\n\", $CACHE_HITS / $COMPILE_REQUESTS * 100}") | ||
| HIT_RATE=$(python3 -c "print(f'{${CACHE_HITS} / ${COMPILE_REQUESTS}:.2f}' if ${COMPILE_REQUESTS} else 'nan')") |
Member
There was a problem hiding this comment.
For situations like this, I prefer to pass variables in as arguments, environment variables, etc. to avoid the risk of code injection. It's admittedly not a big deal in this particular situation, but I still prefer to do it.
Suggested change
| HIT_RATE=$(python3 -c "print(f'{${CACHE_HITS} / ${COMPILE_REQUESTS}:.2f}' if ${COMPILE_REQUESTS} else 'nan')") | |
| HIT_RATE=$(COMPILE_REQUESTS="${COMPILE_REQUESTS}" CACHE_HITS="${CACHE_HITS}" python3 -c "import os; print(f'{int(os.getenv(\"CACHE_HITS\")) / int(os.getenv(\"COMPILE_REQUESTS\")):.2f}' if int(os.getenv(\"COMPILE_REQUESTS\")) else 'nan')") |
Contributor
Author
There was a problem hiding this comment.
This was referenced Oct 21, 2024
rapids-bot bot
pushed a commit
to rapidsai/cuvs
that referenced
this pull request
Oct 22, 2024
Follow-up PR to address feedback: rapidsai/raft#2474 (comment) Authors: - Bradley Dice (https://github.com/bdice) Approvers: - Kyle Edwards (https://github.com/KyleFromNVIDIA) URL: #422
rapids-bot bot
pushed a commit
that referenced
this pull request
Oct 22, 2024
Follow-up PR to address feedback: #2474 (comment) Authors: - Bradley Dice (https://github.com/bdice) Approvers: - Kyle Edwards (https://github.com/KyleFromNVIDIA) URL: #2475
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes an issue in CI computations of sccache hit rates. See rapidsai/cuvs#414 for details.