mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[ML] DF Analytics: update memory estimate after adding exclude fields (#62850)
* update mml estimate when excludes changes * ensure manually input mml is validated once estimated mml loads
This commit is contained in:
parent
abe3ccf1cc
commit
f9ba963af9
1 changed files with 20 additions and 4 deletions
|
@ -55,7 +55,14 @@ export const CreateAnalyticsForm: FC<CreateAnalyticsFormProps> = ({ actions, sta
|
|||
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = docLinks;
|
||||
const { setFormState, setEstimatedModelMemoryLimit } = actions;
|
||||
const mlContext = useMlContext();
|
||||
const { form, indexPatternsMap, isAdvancedEditorEnabled, isJobCreated, requestMessages } = state;
|
||||
const {
|
||||
estimatedModelMemoryLimit,
|
||||
form,
|
||||
indexPatternsMap,
|
||||
isAdvancedEditorEnabled,
|
||||
isJobCreated,
|
||||
requestMessages,
|
||||
} = state;
|
||||
|
||||
const forceInput = useRef<HTMLInputElement | null>(null);
|
||||
const firstUpdate = useRef<boolean>(true);
|
||||
|
@ -152,6 +159,9 @@ export const CreateAnalyticsForm: FC<CreateAnalyticsFormProps> = ({ actions, sta
|
|||
|
||||
const debouncedGetExplainData = debounce(async () => {
|
||||
const shouldUpdateModelMemoryLimit = !firstUpdate.current || !modelMemoryLimit;
|
||||
const shouldUpdateEstimatedMml =
|
||||
!firstUpdate.current || !modelMemoryLimit || estimatedModelMemoryLimit === '';
|
||||
|
||||
if (firstUpdate.current) {
|
||||
firstUpdate.current = false;
|
||||
}
|
||||
|
@ -167,13 +177,12 @@ export const CreateAnalyticsForm: FC<CreateAnalyticsFormProps> = ({ actions, sta
|
|||
const jobConfig = getJobConfigFromFormState(form);
|
||||
delete jobConfig.dest;
|
||||
delete jobConfig.model_memory_limit;
|
||||
delete jobConfig.analyzed_fields;
|
||||
const resp: DfAnalyticsExplainResponse = await ml.dataFrameAnalytics.explainDataFrameAnalytics(
|
||||
jobConfig
|
||||
);
|
||||
const expectedMemoryWithoutDisk = resp.memory_estimation?.expected_memory_without_disk;
|
||||
|
||||
if (shouldUpdateModelMemoryLimit) {
|
||||
if (shouldUpdateEstimatedMml) {
|
||||
setEstimatedModelMemoryLimit(expectedMemoryWithoutDisk);
|
||||
}
|
||||
|
||||
|
@ -340,7 +349,14 @@ export const CreateAnalyticsForm: FC<CreateAnalyticsFormProps> = ({ actions, sta
|
|||
return () => {
|
||||
debouncedGetExplainData.cancel();
|
||||
};
|
||||
}, [jobType, sourceIndex, sourceIndexNameEmpty, dependentVariable, trainingPercent]);
|
||||
}, [
|
||||
jobType,
|
||||
sourceIndex,
|
||||
sourceIndexNameEmpty,
|
||||
dependentVariable,
|
||||
trainingPercent,
|
||||
JSON.stringify(excludes),
|
||||
]);
|
||||
|
||||
// Temp effect to close the context menu popover on Clone button click
|
||||
useEffect(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue