You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/12/21 12:08:51 UTC

[GitHub] [superset] villebro opened a new pull request, #22498: feat(trino): support early cancellation of queries

villebro opened a new pull request, #22498:
URL: https://github.com/apache/superset/pull/22498

   ### SUMMARY
   Currently cancelling queries on Trino fails if the query cancellation request has been submitted before the query id has been retrieved. This typically happens when executing using async query execution, as the query first gets placed on the Celery queue prior to being executed. To work around this, we add a new method `prepare_cancel_query` on `BaseEngineSpec` which is called when calling the query cancellation endpoint. On Trino this will set an "early query cancellation" flag to `True`, which will trigger the query to cancel when the `BaseEngineSpec.handle_cursor` is called during query execution. Appropriate tests are also added.
   
   ### AFTER
   Now stopping a query immediately shows the correct alert for both sync and async modes:
   
   https://user-images.githubusercontent.com/33317356/208901143-bf41975a-24d4-476b-8ede-1a2ba3ccb03e.mp4
   
   ### BEFORE
   
   https://user-images.githubusercontent.com/33317356/208901234-183a11ee-51c8-4730-a2eb-25c845b476d9.mp4
   
   In addition, when running queries in sync mode, cancelling a query would sometimes flash the following error:
   
   ![image](https://user-images.githubusercontent.com/33317356/208893540-a2d5a3c9-6e69-489e-9dd4-069149d6eb38.png)
   
   This was due to the result handler not considering the possibility of the query being returned in a stopped state. To fix this, the query result handling logic is changed to only trigger if the result is successful. 
   
   ### TESTING INSTRUCTIONS
   1. Connect to a Trino database
   2. Execute a long running query and immediately cancel it
   3. Wait for an error to show up complaining about the query failing to stop.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] villebro merged pull request #22498: feat(trino): support early cancellation of queries

Posted by GitBox <gi...@apache.org>.
villebro merged PR #22498:
URL: https://github.com/apache/superset/pull/22498


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] commented on pull request #22498: feat(trino): support early cancellation of queries

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #22498:
URL: https://github.com/apache/superset/pull/22498#issuecomment-1361264409

   # [Codecov](https://codecov.io/gh/apache/superset/pull/22498?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#22498](https://codecov.io/gh/apache/superset/pull/22498?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (eb9a7f0) into [master](https://codecov.io/gh/apache/superset/commit/b954f8f56080270fa7f1f68aa962c9e789e96728?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (b954f8f) will **decrease** coverage by `11.32%`.
   > The diff coverage is `69.23%`.
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #22498       +/-   ##
   ===========================================
   - Coverage   66.90%   55.57%   -11.33%     
   ===========================================
     Files        1851     1851               
     Lines       70697    70712       +15     
     Branches     7764     7764               
   ===========================================
   - Hits        47300    39300     -8000     
   - Misses      21375    29390     +8015     
     Partials     2022     2022               
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `52.35% <56.52%> (-0.01%)` | :arrow_down: |
   | python | `57.46% <78.26%> (-23.79%)` | :arrow_down: |
   | sqlite | `?` | |
   | unit | `51.01% <73.91%> (+0.03%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/22498?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/db\_engine\_specs/hive.py](https://codecov.io/gh/apache/superset/pull/22498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2hpdmUucHk=) | `34.25% <ø> (-53.15%)` | :arrow_down: |
   | [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/22498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `41.12% <ø> (-46.98%)` | :arrow_down: |
   | [...frontend/src/SqlLab/components/ResultSet/index.tsx](https://codecov.io/gh/apache/superset/pull/22498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1Jlc3VsdFNldC9pbmRleC50c3g=) | `61.93% <33.33%> (ø)` | |
   | [superset-frontend/src/SqlLab/reducers/sqlLab.js](https://codecov.io/gh/apache/superset/pull/22498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9yZWR1Y2Vycy9zcWxMYWIuanM=) | `36.87% <33.33%> (ø)` | |
   | [superset/sql\_lab.py](https://codecov.io/gh/apache/superset/pull/22498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc3FsX2xhYi5weQ==) | `78.19% <33.33%> (-3.94%)` | :arrow_down: |
   | [...t-frontend/src/views/CRUD/data/query/QueryList.tsx](https://codecov.io/gh/apache/superset/pull/22498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9xdWVyeS9RdWVyeUxpc3QudHN4) | `53.12% <40.00%> (ø)` | |
   | [superset/db\_engine\_specs/base.py](https://codecov.io/gh/apache/superset/pull/22498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2Jhc2UucHk=) | `74.53% <85.71%> (-14.69%)` | :arrow_down: |
   | [superset-frontend/src/SqlLab/actions/sqlLab.js](https://codecov.io/gh/apache/superset/pull/22498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9hY3Rpb25zL3NxbExhYi5qcw==) | `63.47% <100.00%> (ø)` | |
   | [...src/SqlLab/components/SqlEditorTabHeader/index.tsx](https://codecov.io/gh/apache/superset/pull/22498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1NxbEVkaXRvclRhYkhlYWRlci9pbmRleC50c3g=) | `90.47% <100.00%> (ø)` | |
   | [superset/constants.py](https://codecov.io/gh/apache/superset/pull/22498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29uc3RhbnRzLnB5) | `100.00% <100.00%> (ø)` | |
   | ... and [297 more](https://codecov.io/gh/apache/superset/pull/22498/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org