New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ML] Data Frame Analytics: adds test pipeline action for DFA trained models in models list #168400
[ML] Data Frame Analytics: adds test pipeline action for DFA trained models in models list #168400
Conversation
Pinging @elastic/ml-ui (:ml) |
Gave this a test and looks good. Some possible enhancements:
|
@elasticmachine merge upstream |
@elasticmachine merge upstream |
This is ready for a look when you get a chance 🙏 cc @peteharverson, @walterra |
@elasticmachine merge upstream |
|
||
interface Props { | ||
sourceIndex?: string; | ||
state: MlInferenceState; | ||
mode: 'standAlone' | 'step'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to move this to an enum-like const, something like:
export const TEST_PIPELINE_MODE = {
STAND_ALONE: 'stand_alone',
STEP: 'step',
} as const;
export type TestPipelineMode = typeof TEST_PIPELINE_MODE[keyof typeof TEST_PIPELINE_MODE];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated all to use TEST_PIPELINE_MODE in 2c51898
}); | ||
}, | ||
}); | ||
}, [getDocs, sourceIndex]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these depend on each other, maybe these 3 useCallbacks
can be combined into a single useMemo
, like:
const { getDocs, getSampleDoc, getRandomSampleDoc } = useMemo(() => { ... }, [...]});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 2c51898
defaultMessage="Run a simulation of the pipeline to confirm it produces the anticipated results." | ||
/>{' '} | ||
{state.targetField && ( | ||
{mode === 'step' ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to then use the previously mentioned TEST_PIPELINE_MODE.STEP
here.
</p> | ||
</EuiText> | ||
</EuiFlexItem> | ||
{mode === 'standAlone' ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to use the previously mentioned TEST_PIPELINE_MODE.STAND_ALONE
here.
</EuiTitle> | ||
</EuiFlyoutHeader> | ||
<EuiFlyoutBody> | ||
<TestPipeline state={state} sourceIndex={sourceIndex} mode="standAlone" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to use the previously mentioned TEST_PIPELINE_MODE.STAND_ALONE
here.
@@ -157,7 +157,7 @@ export const AddInferencePipelineFlyout: FC<AddInferencePipelineFlyoutProps> = ( | |||
/> | |||
)} | |||
{step === ADD_INFERENCE_PIPELINE_STEPS.TEST && ( | |||
<TestPipeline sourceIndex={sourceIndex} state={formState} /> | |||
<TestPipeline sourceIndex={sourceIndex} state={formState} mode="step" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to use TEST_PIPELINE_MODE.STEP
here (see comment that suggests replacing the raw strings with an enum-like const).
@@ -15,6 +15,14 @@ import type { ModelItem } from '../models_list'; | |||
|
|||
const PYTORCH_TYPES = Object.values(SUPPORTED_PYTORCH_TASKS); | |||
|
|||
export function isDfaTrainedModel(modelItem: ModelItem) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be more like a type guard, for example:
export function isDfaTrainedModel(arg: unknown): arg is ModelItem) {
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 I don't think it needs to be a type guard since all the items are ModelItem types - it's more checking that certain optional properties exist.
if (isDfaTrainedModel(modelItem)) { | ||
return true; | ||
} | ||
|
||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be just:
return isDfaTrainedModel(modelItem);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 2c51898
x-pack/plugins/ml/public/application/components/ml_inference/components/test_pipeline.tsx
Show resolved
Hide resolved
x-pack/plugins/ml/public/application/components/ml_inference/components/test_pipeline.tsx
Show resolved
Hide resolved
x-pack/plugins/ml/public/application/components/ml_inference/components/test_pipeline.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/ml/public/application/components/ml_inference/components/test_pipeline.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/ml/public/application/components/ml_inference/components/test_pipeline.tsx
Outdated
Show resolved
Hide resolved
The resize behaviour doesn't adjust the titles. And is a bit buggy, the resize control disappears after use. 2023-10-13.12-01-31.2023-10-13.12_01_50.mp4 |
Thanks for taking a look @jgowdyelastic - that's part of an EUI component so agree the best way is to remove the resize option. Removed in 2c51898 |
@elasticmachine merge upstream |
Responded to all comments and made updates where necessary. This is ready for a final look when you get a chance 🙏 |
}); | ||
}, | ||
}), | ||
[getDocs, sourceIndex] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If getDocs
is nowhere else used than in this useMemo
, I was hoping we could move it in there to have just one hook being used for all these queries, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true, although they have different dependencies. As is, getSampleDoc
and getRandomizedSampleDoc
functions are only created once and getDocs
only changes as the arguments change.
I might be missing some context but it's unclear to me what the benefits of having it all in one hook are?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just that multiple hooks that depend on each other might cause multiple re-renders, whereas all code in a single useMemo/useCallback
will just cause one rerender.
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and LGTM.
Just left a suggestion for some extra EuiSpacer
.
<br /> | ||
</> | ||
{state.targetField && ( | ||
<> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest changes LGTM
…odels in models list (elastic#168400) ## Summary Related issue: [Testing data frame analysis models UI](elastic#164440) This PR: - Adds ability to test the DFA model directly by adding the 'Test model' action - Added a link to the simulate pipeline API via 'Learn more' - 'View request body' allows the user to view the request being sent to the simulate pipeline endpoint - Checks if the source index exists and adds a dismissible callout with warning text - Adds a 'reload' option that gets a random sample doc to test - The 'reset' button resets the sample doc to the last used sample doc <img width="1614" alt="image" src="https://github.com/elastic/kibana/assets/6446462/f37430db-5ef4-4088-859c-9f75dd2a14ab"> <img width="1697" alt="image" src="https://github.com/elastic/kibana/assets/6446462/ad6b785f-6e81-437c-93a6-694d19f43e67"> <img width="1624" alt="image" src="https://github.com/elastic/kibana/assets/6446462/cbac54b2-b9ed-41f0-8a80-bf7ed40f723f"> ### Checklist Delete any items that are not applicable to this PR. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [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 - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…odels in models list (elastic#168400) ## Summary Related issue: [Testing data frame analysis models UI](elastic#164440) This PR: - Adds ability to test the DFA model directly by adding the 'Test model' action - Added a link to the simulate pipeline API via 'Learn more' - 'View request body' allows the user to view the request being sent to the simulate pipeline endpoint - Checks if the source index exists and adds a dismissible callout with warning text - Adds a 'reload' option that gets a random sample doc to test - The 'reset' button resets the sample doc to the last used sample doc <img width="1614" alt="image" src="https://github.com/elastic/kibana/assets/6446462/f37430db-5ef4-4088-859c-9f75dd2a14ab"> <img width="1697" alt="image" src="https://github.com/elastic/kibana/assets/6446462/ad6b785f-6e81-437c-93a6-694d19f43e67"> <img width="1624" alt="image" src="https://github.com/elastic/kibana/assets/6446462/cbac54b2-b9ed-41f0-8a80-bf7ed40f723f"> ### Checklist Delete any items that are not applicable to this PR. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [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 - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…odels in models list (elastic#168400) ## Summary Related issue: [Testing data frame analysis models UI](elastic#164440) This PR: - Adds ability to test the DFA model directly by adding the 'Test model' action - Added a link to the simulate pipeline API via 'Learn more' - 'View request body' allows the user to view the request being sent to the simulate pipeline endpoint - Checks if the source index exists and adds a dismissible callout with warning text - Adds a 'reload' option that gets a random sample doc to test - The 'reset' button resets the sample doc to the last used sample doc <img width="1614" alt="image" src="https://github.com/elastic/kibana/assets/6446462/f37430db-5ef4-4088-859c-9f75dd2a14ab"> <img width="1697" alt="image" src="https://github.com/elastic/kibana/assets/6446462/ad6b785f-6e81-437c-93a6-694d19f43e67"> <img width="1624" alt="image" src="https://github.com/elastic/kibana/assets/6446462/cbac54b2-b9ed-41f0-8a80-bf7ed40f723f"> ### Checklist Delete any items that are not applicable to this PR. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [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 - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Summary
Related issue: Testing data frame analysis models UI
This PR:
Checklist
Delete any items that are not applicable to this PR.