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

Timeout param #427

Merged
merged 8 commits into from
Aug 8, 2023
Merged

Timeout param #427

merged 8 commits into from
Aug 8, 2023

Conversation

maximusunc
Copy link
Collaborator

Adds a check for timeout_seconds inside of request parameters sent from Aragorn. This will enable Strider to take longer for kp lookups to provide more thorough answers that get cached in Aragorn.

We're also adding a /clear_cache endpoint so someone can easily clear the onehop cache.

@@ -47,6 +48,8 @@ def __init__(
logger=logger,
preproc=self.get_preprocessor(kp["details"]["preferred_prefixes"]),
postproc=self.get_postprocessor(WBMT.entity_prefix_mapping),
max_batch_size=1,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we thoroughly tested how not batching will impact performance?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. This snuck in cause I have other changes for batch sizing. I've removed it.

@maximusunc maximusunc requested a review from uhbrar August 7, 2023 18:10
Copy link
Collaborator

@kennethmorton kennethmorton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, pending comment review in spirit.

lookup(query_dict, qid), timeout=max_process_time
# get max timeout
timeout = max(
max_process_time, query_dict.get("parameters", {}).get("timeout_seconds", 0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forget the complete details for fastAPI query param parsing. Is it possible for timeout_seconds to end up here as a string or some other non-numeric type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a query param, it's in a dedicated parameters field in the request body on the same level as message. And there's no type checking for timeout_seconds, so someone could pass whatever they wanted. parameters isn't part of the TRAPI spec, so I highly doubt anyone outside of ranking-agent devs are going to even know that this exists.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added type checks

@maximusunc maximusunc merged commit 855ddf5 into master Aug 8, 2023
@maximusunc maximusunc deleted the timeout_param branch August 8, 2023 14:48
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.

3 participants