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

Add a handler to kill a query #1304

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

akoshelev
Copy link
Collaborator

@akoshelev akoshelev commented Sep 22, 2024

In our testing with external parties, it became quite evident that bouncing helpers if query fails is far from having good experience for people who run the test. We need to have an ability to kill queries that failed on one or more helper and restart the runs.

This change does exactly that - adding a /query_id/kill handler that will respond with immediately aborting the task that runs an IPA query.

How to terminate a query?

if helper address is helper.com, one can terminate a query by sending a POST request to

http(s)://helper.com/query/0/kill

For local testing it can be done easily with curl

curl -X POST http://localhost:3002/query/0/kill

if query is killed successfully, the following response is provided by the helper

{"query_id":"0","status":"killed"}

In our testing with external parties, it became quite evident that
bouncing helpers if query fails is far from having good experience
for people who run the test. We need to have an ability to kill queries
that failed on one or more helper and restart the runs.

This change does exactly that - adding a `/query_id/kill` handler
that will respond with immediately aborting the task that runs
an IPA query.
@richajaindce
Copy link
Contributor

Thanks for adding this!! It's going to be really helpful. Can you also add an example of how to run this.

Also, (n00b qn) I am supposing we would get a query id whenever a query is run to call this API?

@akoshelev
Copy link
Collaborator Author

Thanks for adding this!! It's going to be really helpful. Can you also add an example of how to run this.

Also, (n00b qn) I am supposing we would get a query id whenever a query is run to call this API?

good point! I've updated the overview section to show how to terminate a query. Please let me know if something is not clear

Copy link

codecov bot commented Sep 22, 2024

Codecov Report

Attention: Patch coverage is 93.06931% with 14 lines in your changes missing coverage. Please review.

Project coverage is 93.47%. Comparing base (f329272) to head (5ebf875).
Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
ipa-core/src/query/processor.rs 93.24% 5 Missing ⚠️
ipa-core/src/net/server/handlers/query/kill.rs 92.30% 4 Missing ⚠️
ipa-core/src/app.rs 0.00% 2 Missing ⚠️
ipa-core/src/net/transport.rs 92.59% 2 Missing ⚠️
ipa-core/src/net/http_serde.rs 97.22% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1304      +/-   ##
==========================================
+ Coverage   93.41%   93.47%   +0.05%     
==========================================
  Files         208      210       +2     
  Lines       33798    34023     +225     
==========================================
+ Hits        31574    31804     +230     
+ Misses       2224     2219       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@eriktaubeneck eriktaubeneck left a comment

Choose a reason for hiding this comment

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

thank you! this is awesome.

it would be worthwhile to also add a subcommand to the report collector binary that calls this on all helpers in a network file, but I can take that as a work item in follow up.

}

impl Request {
/// see above for the reason why this needs to be behind a feature flag
Copy link
Member

Choose a reason for hiding this comment

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

why are these different feature flags? does cli need to be included, so that this is available when run from the cli as a helper?

@akoshelev
Copy link
Collaborator Author

it would be worthwhile to also add a subcommand to the report collector binary that calls this on all helpers in a network file, but I can take that as a work item in follow up.

Great idea, this can totally be a separate PR to keep things manageable

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