dosubot[bot] commented on issue #31814:
URL: https://github.com/apache/superset/issues/31814#issuecomment-2587028757

   <!-- Greeting -->
   Hey there, @talh3747! I'm here to help you with your Superset issue. I can 
assist with bug fixes, answer your questions, and guide you on becoming a 
contributor. Let's dive in and tackle this challenge together!
   
   <!-- Answer -->
   The issue you're experiencing with query cancellation in Superset's SQL Lab 
when using Trino as the database engine could be related to several factors. 
Here are some potential areas to investigate:
   
   1. **Celery Worker Configuration**: Ensure that your Celery workers are 
correctly configured to receive and execute tasks. The `CELERY_CONFIG` in your 
`superset_config.py` should be properly set up, and the Celery worker should be 
started with the correct command. Verify that the broker URL and result backend 
are correctly configured and that the necessary imports are included 
<sup>[[1]](https://github.com/apache/superset/blob/master/docs/docs/configuration/async-queries-celery.mdx)</sup>.
   
   2. **Query Cancellation Mechanism**: Superset uses a `cancel_query_id` 
stored in the query's extra JSON payload to identify and cancel queries. Ensure 
that this ID is being correctly set and retrieved. The `client_id` is crucial 
for identifying the query session for cancellation 
<sup>[[2]](https://github.com/apache/superset/blob/master/superset/db_engine_specs/trino.py)</sup><sup>[[3]](https://github.com/apache/superset/blob/master/superset/daos/query.py)</sup>.
   
   3. **Trino-Specific Settings**: Check the settings related to Trino in 
Superset, such as the `QUERY_CANCEL_KEY` and `QUERY_EARLY_CANCEL_KEY`. These 
are used to manage query cancellation and should be correctly implemented 
<sup>[[2]](https://github.com/apache/superset/blob/master/superset/db_engine_specs/trino.py)</sup>.
   
   4. **Error Handling**: The 422 (unprocessable entity) error suggests that 
there might be an issue with the request payload or the way the query 
cancellation is being handled. Double-check the API request format and ensure 
that all required parameters are correctly specified.
   
   5. **Logs and Debugging**: Since you mentioned that the worker logs do not 
show task reception, ensure that the Celery worker is running and connected to 
the broker. Check the logs for any errors or warnings that might indicate 
connectivity or configuration issues.
   
   6. **Database Engine Support**: Ensure that Trino supports the query 
cancellation features being used. If the cancellation key is not set or if the 
database engine does not support explicit cancellation, the query cannot be 
stopped 
<sup>[[4]](https://github.com/apache/superset/blob/master/superset/sql_lab.py)</sup>.
   
   By addressing these areas, you should be able to identify and resolve the 
issue with query cancellation in Superset.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   
   ---
   <sup>Help Dosu learn! Give it feedback: [Great 
Response](https://app.dosu.dev/response-feedback/965b9163-e119-4145-8c36-13b97b9fd20b?feedback_type=great_response)
 | [Irrelevant 
Answer](https://app.dosu.dev/response-feedback/965b9163-e119-4145-8c36-13b97b9fd20b?feedback_type=irrelevant_answer)
 | [Incorrect 
Sources](https://app.dosu.dev/response-feedback/965b9163-e119-4145-8c36-13b97b9fd20b?feedback_type=incorrect_sources)
 | [Too 
Verbose](https://app.dosu.dev/response-feedback/965b9163-e119-4145-8c36-13b97b9fd20b?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/965b9163-e119-4145-8c36-13b97b9fd20b?feedback_type=hallucination)
 | 
[Other](https://app.dosu.dev/response-feedback/965b9163-e119-4145-8c36-13b97b9fd20b?feedback_type=other)</sup>
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to