Skip to content

Commit

Permalink
[Enterprise Search] Fix pipeline generation after deploying a model i…
Browse files Browse the repository at this point in the history
…n place (#173872)

## Summary

Fix for a bug that occurs after deploying a curated ML model (ELSER/E5)
and selecting it for an inference pipeline. The generated pipeline is
empty and the create action fails. This PR fixes this issue.

Before


https://github.com/elastic/kibana/assets/14224983/9b32ac68-4303-44f3-9e9d-6441d7716905

After


https://github.com/elastic/kibana/assets/14224983/d2e67a31-814c-4b1c-aca7-92909f6c47e5


### Checklist
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
  • Loading branch information
demjened authored Dec 21, 2023
1 parent 833eebf commit 13c1dfa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -639,29 +639,33 @@ describe('MlInferenceLogic', () => {
AddInferencePipelineSteps.Fields
);
});
it('triggers pipeline fetch when moving from configuration step', () => {
it('triggers pipeline and model fetch when moving from configuration step', () => {
MLInferenceLogic.actions.setInferencePipelineConfiguration({
...MLInferenceLogic.values.addInferencePipelineModal.configuration,
pipelineName: 'unit-test-pipeline',
modelID: 'unit-test-model',
existingPipeline: false,
});
jest.spyOn(MLInferenceLogic.actions, 'fetchPipelineByName');
jest.spyOn(MLInferenceLogic.actions, 'makeMLModelsRequest');
MLInferenceLogic.actions.onAddInferencePipelineStepChange(AddInferencePipelineSteps.Fields);
expect(MLInferenceLogic.actions.fetchPipelineByName).toHaveBeenCalledWith({
pipelineName: 'ml-inference-unit-test-pipeline',
});
expect(MLInferenceLogic.actions.makeMLModelsRequest).toHaveBeenCalledWith(undefined);
});
it('does not trigger pipeline fetch existing pipeline is selected', () => {
it('does not trigger pipeline and model fetch existing pipeline is selected', () => {
MLInferenceLogic.actions.setInferencePipelineConfiguration({
...MLInferenceLogic.values.addInferencePipelineModal.configuration,
pipelineName: 'unit-test-pipeline',
modelID: 'unit-test-model',
existingPipeline: true,
});
jest.spyOn(MLInferenceLogic.actions, 'fetchPipelineByName');
jest.spyOn(MLInferenceLogic.actions, 'makeMLModelsRequest');
MLInferenceLogic.actions.onAddInferencePipelineStepChange(AddInferencePipelineSteps.Fields);
expect(MLInferenceLogic.actions.fetchPipelineByName).not.toHaveBeenCalled();
expect(MLInferenceLogic.actions.makeMLModelsRequest).not.toHaveBeenCalled();
});
});
describe('fetchPipelineSuccess', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ export const MLInferenceLogic = kea<
});
// Continue to the next step so we don't have to save it to state, we will change
// back to the Configuration step if we find a pipeline with the same name

// Re-fetch ML model list to include those that were deployed in this step
actions.makeMLModelsRequest(undefined);
}
actions.setAddInferencePipelineStep(step);
},
Expand Down

0 comments on commit 13c1dfa

Please sign in to comment.