Skip to content

Commit

Permalink
[ML] File upload fixing inference timeout check (elastic#204722)
Browse files Browse the repository at this point in the history
Fixes issue in serverless where the inference call to deploy elser times
out, which is expected, but returns with an unexpected `500` error code.
This causes the UI to stop the upload process.

![image](https://github.com/user-attachments/assets/57b3007f-5a67-4c99-b6bd-360c7b5b788f)


This PR increases the timeout length to 10mins and allows for `500`
errors just in case.
Testing this shows that with the extra timeout time in kibana, another
timeout happens at 1min but this returns with an expected `408`.
Therefore allowing for `500`s might not be needed, but I don't think
there is any harm.
  • Loading branch information
jgowdyelastic authored Dec 24, 2024
1 parent d5fe929 commit 155bdd0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class AutoDeploy {
// we'll know when it's ready from polling the inference endpoints
// looking for num_allocations
const status = e.response?.status;
if (status === 408 || status === 504 || status === 502) {
if (status === 408 || status === 504 || status === 502 || status === 500) {
return;
}
this.inferError = e;
Expand Down
11 changes: 7 additions & 4 deletions x-pack/platform/plugins/private/data_visualizer/server/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,13 @@ export function routes(coreSetup: CoreSetup<StartDeps, unknown>, logger: Logger)
const inferenceId = request.params.inferenceId;
const input = request.body.input;
const esClient = (await context.core).elasticsearch.client;
const body = await esClient.asCurrentUser.inference.inference({
inference_id: inferenceId,
input,
});
const body = await esClient.asCurrentUser.inference.inference(
{
inference_id: inferenceId,
input,
},
{ maxRetries: 0, requestTimeout: 10 * 60 * 1000 }
);

return response.ok({ body });
} catch (e) {
Expand Down

0 comments on commit 155bdd0

Please sign in to comment.