-
Notifications
You must be signed in to change notification settings - Fork 11
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
add a query parameter to disable redis caching #224
Comments
Just to clarify, you want an option for the user to specify a caching param in the request? |
This is what I have in mind: Dy default, the query is submitted like this: POST /v1/query (with the body as the query graph) With an optional query parameter, we can make the same query like this: POST /v1/query?caching=false (body is the same query graph) to disable the default caching behavior. |
Feature: Add caching query param (Fix issue #224)
When I post a query to https://api.bte.ncats.io/v1/query?caching=false, I get the following error:
I've tested a handful of queries with the same behavior, so it does not appear to be query-dependent. I can also reproduce this on my local instance when sending a query to http://localhost:3000/v1/query/?caching=false. |
@andrewsu should I also modify BTE's smartapi registration to include the caching parameter (for query endpoints)? https://github.com/NCATS-Tangerine/translator-api-registry/blob/32737525ff94ad8f5223d8a4f77031d6cca4d91e/biothings_explorer/smartapi.yaml#L100 I have a bit of an idea of how to do that, but not fully sure about the openapi/smartapi spec... [EDIT] looks like what eric edited was a local copy of the smartapi registration yaml... |
huh, interesting question. Clearly the local version is necessary and used in this validation step: https://github.com/biothings/BioThings_Explorer_TRAPI/blob/main/src/middlewares/validate.js#L18. But the local version has also diverged from the smartAPI version here https://github.com/NCATS-Tangerine/translator-api-registry/blob/master/biothings_explorer/smartapi.yaml. I don't particularly like to have two versions hanging around, but we also don't want to validate every query against a file in another repo. In the interest of expediency, I'm fine merging this PR just to fix the issue. But probably we should discuss if we want to change how we handle this... |
@andrewsu my understanding is that the local version is meant to match the smartapi version... |
@colleenXu you may try the latest BTE metadata from SmartAPI locally to see if any further changes are needed. And I agree that this file should be sync'ed with the smartapi version. |
@newgene @andrewsu to clarify: what endpoints have the caching parameter? Currently I've added updates to the PR for the local file #350 and the smartapi registration yaml https://github.com/NCATS-Tangerine/translator-api-registry/blob/master/biothings_explorer/smartapi.yaml, so they are identical. Both files have the caching parameter specified on the /query endpoints only (v1/query, v1/smartapi/{}/query, and v1/team/{}/query)... |
By default, Redis caching is enabled when
REDIS_HOST
andREDIS_PORT
env variables are provided. Sometime, for debugging purpose, just to rule out the issue with the caching, we want to query BTE without caching. An extra query parameter likecaching=false
can be added to temporarily disable the caching.Relevant code is here:
https://github.com/biothings/bte_trapi_query_graph_handler/blob/main/src/cache_handler.js
The text was updated successfully, but these errors were encountered: