-
Notifications
You must be signed in to change notification settings - Fork 4
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
Implement Reader Performance Queries for /datafiles and /datasets #488
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #488 +/- ##
===========================================
- Coverage 96.66% 43.45% -53.22%
===========================================
Files 39 40 +1
Lines 3242 3325 +83
Branches 317 326 +9
===========================================
- Hits 3134 1445 -1689
- Misses 80 1872 +1792
+ Partials 28 8 -20
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
475e1a1
to
d7f74c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having reviewed the code, made a number of changes to it and tested it on preprod, I'm happy that it is functioning as required. I think there are just a few things to complete the code to a "production" level: complete the TODOs, add docstrings to each function, and add some tests for the new functionality. That last one may not be trivial given that it probably requires starting up a new instance of the API using a different config.
- If there's an issue when logging in (e.g. due to invalid credentials), the user will now return a 500, not a 403
- Add docstrings - Remove client_pool kwargs - Add type hints - Fix any outstanding linting issues
- As ever, the vulnerabilities that are being ignored are because we cannot upgrade due to being tied to 3.6
- The final diff in the CI will still fail because `main` doesn't contain these dropped columns, but the initial diff to check that two runs produce identical data should pass
cad8b4f
to
e361e2b
Compare
This is ready for review. I've addressed the TODOs, added documentation in the form of docstrings and added a test class to test the new functionality. Quite a bit of time went into fixing the CI which was broken, presumably because a PR hasn't gone through this repo for a little while. I've also edited a couple of the commit messages so a new release will be made. The generator script CI job fails but this is intentional - final diff in the CI will still fail because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Thanks for tidying up the code and adding the tests.
And thanks for implementing this bit of functionality which appears to have been successful in reducing database load.
This PR will close #{issue number}
Description
These changes allow efficiency gains to be made when either the datafiles or datasets are being queried, with a WHERE filter for an ID of the parent entity (e.g. WHERE dataset.id = 4 on /datafiles). The changes have been implemented for the count endpoints of datafiles and datasets.
If a relevant request comes in, the API queries the parent entity directly, to check whether the user can see it (i.e. has the permissions to). If the user can, their original query is sent to ICAT (JPQL query constructed by Python ICAT as normal) but it is executed as the 'reader' user (as configured in
config.yaml
). This should bypass the additional complexity added to queries by ICAT Server, which is causing performance issues. As I don't have rules setup in my ICAT, I wasn't able to test this, but hopefully testing next week done by others should test that.This functionality is completely optional - if the config isn't in
config.yaml
or it is disabled, the API will behave as normal (i.e. pass user queries onto ICAT as the user of the API request).Testing Instructions
Add a set up instructions describing how the reviewer should test the code
icatdb Generator Script Consistency Test
CI job fails, is this because of a deliberate change made to the script to change generated data (which isn't actually a problem) or is here an underlying issue with the changes made?fix:
,feat:
orBREAKING CHANGE:
so a release is automatically made via GitHub Actions upon merge?Agile Board Tracking
Connect to #{issue number}