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

[Discover] Cancel S3 Queries Using SQL Plugin #9355

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

Conversation

sejli
Copy link
Member

@sejli sejli commented Feb 7, 2025

Description

When ongoing S3 queries are aborted in Discover, the backend job should also be canceled/deleted. This PR uses the SQL plugin API to delete ongoing jobs to cancel them.

Issues Resolved

Screenshot

Testing the changes

Changelog

  • feat: Deletes S3 Jobs in Backend when Original Query is Canceled

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@sejli sejli added discover for discover reinvent backport 2.x v2.20.0 labels Feb 7, 2025
Copy link

codecov bot commented Feb 7, 2025

Codecov Report

Attention: Patch coverage is 0% with 12 lines in your changes missing coverage. Please review.

Project coverage is 61.71%. Comparing base (0994dbe) to head (3a695da).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...nts/server/routes/data_source_connection/routes.ts 0.00% 7 Missing ⚠️
src/plugins/query_enhancements/common/utils.ts 0.00% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9355   +/-   ##
=======================================
  Coverage   61.71%   61.71%           
=======================================
  Files        3816     3816           
  Lines       91829    91841   +12     
  Branches    14543    14546    +3     
=======================================
+ Hits        56668    56680   +12     
  Misses      31506    31506           
  Partials     3655     3655           
Flag Coverage Δ
Linux_1 28.99% <ø> (ø)
Linux_2 56.46% <ø> (ø)
Linux_3 39.18% <ø> (ø)
Linux_4 28.90% <0.00%> (-0.01%) ⬇️
Windows_1 29.02% <ø> (+0.01%) ⬆️
Windows_2 56.41% <ø> (ø)
Windows_3 39.18% <ø> (ø)
Windows_4 28.90% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Signed-off-by: Sean Li <[email protected]>
Copy link
Member

Choose a reason for hiding this comment

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

javascript file :(

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like a lot of our Cypress tests are JavaScript files, is that something we want to change?

@@ -21,6 +21,8 @@ export const DS_API = {
};
export const DSM_API = '/internal/data-source-management/fetchDataSourceMetaData';

export const DELETE_API = '/api/enhancements/jobs';
Copy link
Member

Choose a reason for hiding this comment

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

unrelated to this PR but not a big fan of the multiple constants defined instead of using nested constants for similar things like APIs, when issue is the number of modifications increasing as I will have to import each constant individually.

@kavilla
Copy link
Member

kavilla commented Feb 12, 2025

i think looks good to me. can we confirm this is wired up ? in the places we expect. or did we have fast follows to add that. as in abort query on navigation away from discover. abort query if closing the dataset selector. abort query if new query is fired (pretty sure already done)

@sejli
Copy link
Member Author

sejli commented Feb 14, 2025

So far, it's wired up to the point where the delete request will be sent when the query enhancement's fetch() function is aborted. So, entirely dependent on how this fetch function picks up the AbortSignal.

abort query if new query is fired

This is the main thing that this PR acheives.

abort query if closing the dataset selector.

Do we want this? If we start loading something like databases and close the dataset selector, wouldn't we want that to load in the background? I think it's intended behavior.

as in abort query on navigation away from discover

Think this will probably need a fast followup or some improvements on how I'm doing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants