Skip to content

Commit

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

# Backport

This will backport the following commits from `main` to `8.12`:
- [[Enterprise Search] Fix pipeline generation after deploying a model
in place (#173872)](#173872)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Adam
Demjen","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-12-21T21:49:42Z","message":"[Enterprise
Search] Fix pipeline generation after deploying a model in place
(#173872)\n\n## Summary\r\n\r\nFix for a bug that occurs after deploying
a curated ML model (ELSER/E5)\r\nand selecting it for an inference
pipeline. The generated pipeline is\r\nempty and the create action
fails. This PR fixes this
issue.\r\n\r\nBefore\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/14224983/9b32ac68-4303-44f3-9e9d-6441d7716905\r\n\r\nAfter\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/14224983/d2e67a31-814c-4b1c-aca7-92909f6c47e5\r\n\r\n\r\n###
Checklist\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"13c1dfaaf588691523b327c4f298e3ddabce2711","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:EnterpriseSearch","v8.12.0","v8.12.1","v8.13.0"],"number":173872,"url":"https://github.com/elastic/kibana/pull/173872","mergeCommit":{"message":"[Enterprise
Search] Fix pipeline generation after deploying a model in place
(#173872)\n\n## Summary\r\n\r\nFix for a bug that occurs after deploying
a curated ML model (ELSER/E5)\r\nand selecting it for an inference
pipeline. The generated pipeline is\r\nempty and the create action
fails. This PR fixes this
issue.\r\n\r\nBefore\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/14224983/9b32ac68-4303-44f3-9e9d-6441d7716905\r\n\r\nAfter\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/14224983/d2e67a31-814c-4b1c-aca7-92909f6c47e5\r\n\r\n\r\n###
Checklist\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"13c1dfaaf588691523b327c4f298e3ddabce2711"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/173872","number":173872,"mergeCommit":{"message":"[Enterprise
Search] Fix pipeline generation after deploying a model in place
(#173872)\n\n## Summary\r\n\r\nFix for a bug that occurs after deploying
a curated ML model (ELSER/E5)\r\nand selecting it for an inference
pipeline. The generated pipeline is\r\nempty and the create action
fails. This PR fixes this
issue.\r\n\r\nBefore\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/14224983/9b32ac68-4303-44f3-9e9d-6441d7716905\r\n\r\nAfter\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/14224983/d2e67a31-814c-4b1c-aca7-92909f6c47e5\r\n\r\n\r\n###
Checklist\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"13c1dfaaf588691523b327c4f298e3ddabce2711"}}]}]
BACKPORT-->

Co-authored-by: Adam Demjen <[email protected]>
  • Loading branch information
kibanamachine and demjened authored Dec 21, 2023
1 parent 4e7566d commit 713f89f
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 713f89f

Please sign in to comment.