Feature/replace caching#102
Conversation
…een calls so I split the tests into two functions
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (69.64%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #102 +/- ##
===========================================
+ Coverage 83.46% 87.16% +3.70%
===========================================
Files 18 18
Lines 2546 2571 +25
===========================================
+ Hits 2125 2241 +116
+ Misses 421 330 -91
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Noting that tests/test_ipr/test_upload.py takes twice as long to run with this (3 mins to 6). If we want to incorporate this change to help with use of the package at scale we should probably make it optional somehow |
where are you getting the 6m for that particular test file from? nothing in this PR should affect IPR upload as this was strictly gkb caching. |
|
test_upload is an end-to-end test that incorporates gkb matching. |
|
I did some load testing of this myself using the test_main script since interactions with IPR are not impacted by any of the changes in this PR. I ran several iterations on both versions all run from the same server both using python 3.11.6. Some run overlapping each other, some run not overlapping. It varies quite a bit depending on the load on the gkb server at the time the script is run (I was running other scripts against gkb from a different server while doing all this test) master branch this branch PR branch: 2:42 - 4:35 |
|
I've been seeing runtimes like this when I use test_upload.py to benchmark: Branch: feature/replace-caching Branch: develop (These are from alternating runs - run on feat, switch to dev, run on dev, switch to feat, etc) I tried with cache-control True and False and got basically the same times. But when I use a version of test_upload that only runs create_report once, I see better times on the feature branch than on dev: Branch: feature/replace-caching Branch: develop It seems like what's happening is the session-level implementation in feat is removing the benefit that specifically test_upload was seeing from module-level caching. So if there are multiple GKB conns being used, the benefit from caching will be removed. I think this is an improvement in normal use. I took a look at gsc_report and it looks like a single GKB conn is used for create_report so it shouldn't affect performance there. edit to add - I assume the rate limiter will slow things down though - appreciate having this disabled during tests. |
This replaces the custom caching with a standard caching library. It is very useful if you want to cache between scripts to (for example) an sqlite database so if you were generating many reports right after one another you could so so without having to make as many API calls. By default this will just use an in-memory cache (similar to the current behaviour) unless a cache_name is given.
However I am not sure if the one function i deleted is in use anywhere so that should be double checked with other stakeholders.