Skip to content
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] DF Analytics wizard: ensure user can set mml manually or select to use given estimate #81078

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
EuiLink,
EuiSelect,
EuiSpacer,
EuiSwitch,
EuiTitle,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -138,7 +139,7 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = docLinks;

const { setEstimatedModelMemoryLimit, setFormState } = actions;
const { form, isJobCreated } = state;
const { form, isJobCreated, estimatedModelMemoryLimit, cloneJob } = state;
const {
computeFeatureInfluence,
eta,
Expand All @@ -161,6 +162,8 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
randomizeSeed,
} = form;

const [useEstimatedMml, setUseEstimatedMml] = useState<boolean>(cloneJob === undefined);
peteharverson marked this conversation as resolved.
Show resolved Hide resolved

const [numTopClassesOptions, setNumTopClassesOptions] = useState<EuiComboBoxOptionOption[]>([
defaultNumTopClassesOption,
]);
Expand Down Expand Up @@ -204,7 +207,9 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
if (success) {
if (modelMemoryLimit !== expectedMemory) {
setEstimatedModelMemoryLimit(expectedMemory);
setFormState({ modelMemoryLimit: expectedMemory });
if (useEstimatedMml === true) {
setFormState({ modelMemoryLimit: expectedMemory });
}
}
} else {
// Check which field is invalid
Expand Down Expand Up @@ -481,18 +486,31 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
}
)}
>
<EuiFieldText
placeholder={
jobType !== undefined
? DEFAULT_MODEL_MEMORY_LIMIT[jobType]
: DEFAULT_MODEL_MEMORY_LIMIT.outlier_detection
}
disabled={isJobCreated}
value={modelMemoryLimit || ''}
onChange={(e) => setFormState({ modelMemoryLimit: e.target.value })}
isInvalid={modelMemoryLimitValidationResult !== null}
data-test-subj="mlAnalyticsCreateJobWizardModelMemoryInput"
/>
<>
<EuiFieldText
placeholder={
jobType !== undefined
? DEFAULT_MODEL_MEMORY_LIMIT[jobType]
: DEFAULT_MODEL_MEMORY_LIMIT.outlier_detection
}
disabled={isJobCreated || useEstimatedMml}
value={useEstimatedMml ? estimatedModelMemoryLimit : modelMemoryLimit || ''}
onChange={(e) => setFormState({ modelMemoryLimit: e.target.value })}
isInvalid={modelMemoryLimitValidationResult !== null}
data-test-subj="mlAnalyticsCreateJobWizardModelMemoryInput"
/>
<EuiSpacer size="xs" />
peteharverson marked this conversation as resolved.
Show resolved Hide resolved
<EuiSwitch
disabled={isJobCreated}
name="mlDataFrameAnalyticsUseEstimatedMml"
label={i18n.translate('xpack.ml.dataframe.analytics.create.UseEstimatedMmlLabel', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super duper nit: create.useEstimatedMmlLabel here to match the convention

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 66bcffa
👍 😄

defaultMessage: 'Use estimated model memory limit',
})}
checked={useEstimatedMml === true}
onChange={() => setUseEstimatedMml(!useEstimatedMml)}
data-test-subj="mlAnalyticsCreateJobWizardUseEstimatedMml"
/>
</>
</EuiFormRow>
</EuiFlexItem>
<EuiFlexItem>
Expand Down