Skip to content

[ML] Incorrect response when trying to stop a failed data frame transform without force=true #44103

Closed
@dolaru

Description

@dolaru

Spotted in 7.3.0

When trying to stop a failed data frame transform without specifying force=true in query params, the status code and format of the response is not what you'd expect.

Currently the API responds with 200 and the body looks like this:


{
  "task_failures" : [ {
    "task_id" : 15302,
    "node_id" : "1TYVPNuERNe40f9tTRPVAQ",
    "status" : "CONFLICT",
    "reason" : {
      "type" : "status_exception",
      "reason" : "Unable to stop data frame transform [some_data_frame_id] as it is in a failed state with reason: [task encountered more than 10 failures; latest failure: Failed to retrieve checkpoint]. Use force stop to stop the data frame transform."
    }
  } ],
  "acknowledged" : false
}


In order to be consistent with the rest of the ML APIs, what we should be receiving instead should be a 409 and a body that looks like this:

{
    "error": {
        "root_cause": [
            {
                "type": "status_exception",
                "reason": "Unable to stop data frame transform [some_data_frame_id] as it is in a failed state. Use force stop to stop the data frame transform."
            }
        ],
        "type": "status_exception",
        "reason": "Unable to stop data frame transform [some_data_frame_id] as it is in a failed state. Use force stop to stop the data frame transform."
    },
    "status": 409
}

Steps to reproduce

  1. Create a data frame
  2. Start it and cause it to fail. (deleting the source index is one way to do it)
  3. After the task state becomes failed, send the _stop request without specifying force=true as a query parameter.
  4. Notice that the response status code and body format is not consistent with the usual error response format in ES APIs.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions