stop_query_execution¶
- PlaygroundApi.stop_query_execution(queryid, role_id, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)¶
Stop a running query
Requests cancellation of a query. The caller must be the user who submitted the query; a Super Admin (via the X-Amorphic-Super-Admin header) may cancel any query. Cancellation is asynchronous. A 200 means the stop was accepted, and the returned QueryStatus is the state observed at that moment, not a guaranteed final state. A query that has already finished cannot be stopped and is reported with GE-1034 as HTTP 500. Note that an unknown query id is reported as HTTP 400 with IPV-1002, not 404.
- Parameters:
queryid (str) – Identifier of the query to stop. (required)
role_id (str) – Amorphic role ID the request is authorized against. Must be a role the caller belongs to. (required)
_request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
_request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
_content_type (str, Optional) – force content-type for the request.
_headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
_host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
- Return type:
- Returns:
Returns the result object.
Request and Response Examples¶
HTTP: DELETE /queries/{queryid}
Parameter examples¶
Name |
In |
Example |
|---|---|---|
|
path |
|
|
header |
|
Success (HTTP 200)¶
Stop request accepted. QueryStatus reports the state observed when the stop was processed.
Stop accepted and in progress
{
"QueryId": "b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f",
"QueryStatus": "CANCELLING"
}
Query was already cancelled
{
"QueryId": "b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f",
"QueryStatus": "CANCELLED"
}
Query completed before the stop took effect
{
"QueryId": "b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f",
"QueryStatus": "SUCCEEDED"
}
Errors¶
Documented error codes: IPV-1002, AUTH-1010, AUTH-1001, AUTH-1030, GE-1060, GE-1034, RTE-1001.
HTTP 400
Input validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Codes: IPV-1002 (query id not found), AUTH-1010 (the query belongs to a different user), AUTH-1001 / AUTH-1030 / GE-1060 (authorization).
Unknown query id
{
"Message": "IPV-1002 - Invalid QueryId - b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f, resource not found."
}
Query belongs to another user
{
"Message": "AUTH-1010 - User is not authorized to perform this operation"
}
HTTP 500
Backend failure, and also the case where the query is in a state that cannot be stopped, which the handler raises as GE-1034 rather than a 400. Body is {“Message”: “<CODE> - <text>”}.
Query is not in a stoppable state
{
"Message": "GE-1034 - Cannot stop the execution of query b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f which is in SUCCEEDED state"
}
Generic backend failure
{
"Message": "RTE-1001 - <exception details>"
}