mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
* [ML] Removing log error statements when no ingest pipileins exist * removing non 200 status code check Co-authored-by: James Gowdy <jgowdy@elastic.co>
This commit is contained in:
parent
1fc225b876
commit
e57cb4e761
1 changed files with 20 additions and 15 deletions
|
@ -49,26 +49,31 @@ export function modelsProvider(
|
|||
modelIds.map((id: string) => [id, null])
|
||||
);
|
||||
|
||||
const { body, statusCode } = await client.asCurrentUser.ingest.getPipeline();
|
||||
try {
|
||||
const { body } = await client.asCurrentUser.ingest.getPipeline();
|
||||
|
||||
if (statusCode !== 200) {
|
||||
return modelIdsMap;
|
||||
}
|
||||
for (const [pipelineName, pipelineDefinition] of Object.entries(body)) {
|
||||
const { processors } = pipelineDefinition as { processors: Array<Record<string, any>> };
|
||||
|
||||
for (const [pipelineName, pipelineDefinition] of Object.entries(body)) {
|
||||
const { processors } = pipelineDefinition as { processors: Array<Record<string, any>> };
|
||||
|
||||
for (const processor of processors) {
|
||||
const id = processor.inference?.model_id;
|
||||
if (modelIdsMap.has(id)) {
|
||||
const obj = modelIdsMap.get(id);
|
||||
if (obj === null) {
|
||||
modelIdsMap.set(id, { [pipelineName]: pipelineDefinition });
|
||||
} else {
|
||||
obj![pipelineName] = pipelineDefinition;
|
||||
for (const processor of processors) {
|
||||
const id = processor.inference?.model_id;
|
||||
if (modelIdsMap.has(id)) {
|
||||
const obj = modelIdsMap.get(id);
|
||||
if (obj === null) {
|
||||
modelIdsMap.set(id, { [pipelineName]: pipelineDefinition });
|
||||
} else {
|
||||
obj![pipelineName] = pipelineDefinition;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.statusCode === 404) {
|
||||
// ES returns 404 when there are no pipelines
|
||||
// Instead, we should return the modelIdsMap and a 200
|
||||
return modelIdsMap;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
return modelIdsMap;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue