-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[ML] Adding option to create AD jobs without starting the datafeed #77484
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
Merged
jgowdyelastic
merged 10 commits into
elastic:master
from
jgowdyelastic:adding-do-not-start-datafeed-switch-to-job-wizards
Sep 17, 2020
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3f28920
[ML] Adding option to create AD jobs without starting the datafeed
jgowdyelastic 80760d2
changing translation id
jgowdyelastic 4531903
i just need some space
jgowdyelastic 52e8830
Merge branch 'master' into adding-do-not-start-datafeed-switch-to-job…
elasticmachine d9a31e1
adding missed spelling change
jgowdyelastic ced6f1b
Merge branch 'master' into adding-do-not-start-datafeed-switch-to-job…
elasticmachine 2ec87e1
disabling switch when running
jgowdyelastic 12aa78d
Merge branch 'master' into adding-do-not-start-datafeed-switch-to-job…
elasticmachine fb025a1
improving logic
jgowdyelastic 252c1c7
further test improvements
jgowdyelastic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...tion/jobs/new_job/pages/components/summary_step/components/start_datafeed_switch/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| export { StartDatafeedSwitch } from './start_datafeed_switch'; |
44 changes: 44 additions & 0 deletions
44
.../pages/components/summary_step/components/start_datafeed_switch/start_datafeed_switch.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import React, { FC } from 'react'; | ||
| import { i18n } from '@kbn/i18n'; | ||
| import { EuiSwitch, EuiFormRow, EuiSpacer } from '@elastic/eui'; | ||
| interface Props { | ||
| startDatafeed: boolean; | ||
| setStartDatafeed(start: boolean): void; | ||
| disabled?: boolean; | ||
| } | ||
|
|
||
| export const StartDatafeedSwitch: FC<Props> = ({ | ||
| startDatafeed, | ||
| setStartDatafeed, | ||
| disabled = false, | ||
| }) => { | ||
| return ( | ||
| <> | ||
| <EuiSpacer /> | ||
| <EuiFormRow | ||
| helpText={i18n.translate( | ||
| 'xpack.ml.newJob.wizard.summaryStep.startDatafeedCheckboxHelpText', | ||
| { | ||
| defaultMessage: 'If unselected, job can be started later from the jobs list.', | ||
| } | ||
| )} | ||
| > | ||
| <EuiSwitch | ||
| data-test-subj="mlJobWizardStartDatafeedCheckbox" | ||
| label={i18n.translate('xpack.ml.newJob.wizard.summaryStep.startDatafeedCheckbox', { | ||
| defaultMessage: 'Start immediately', | ||
| })} | ||
| checked={startDatafeed} | ||
| onChange={(e) => setStartDatafeed(e.target.checked)} | ||
| disabled={disabled} | ||
| /> | ||
| </EuiFormRow> | ||
| </> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
151 changes: 151 additions & 0 deletions
151
x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job_without_datafeed_start.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import { FtrProviderContext } from '../../../ftr_provider_context'; | ||
|
|
||
| export default function ({ getService }: FtrProviderContext) { | ||
| const esArchiver = getService('esArchiver'); | ||
| const ml = getService('ml'); | ||
|
|
||
| const jobId = `fq_single_1_${Date.now()}`; | ||
| const aggAndFieldIdentifier = 'Mean(responsetime)'; | ||
| const bucketSpan = '30m'; | ||
|
|
||
| function getExpectedRow(expectedJobId: string) { | ||
| return { | ||
| id: expectedJobId, | ||
| description: '', | ||
| jobGroups: [], | ||
| recordCount: '0', | ||
| memoryStatus: 'ok', | ||
| jobState: 'closed', | ||
| datafeedState: 'stopped', | ||
| latestTimestamp: '', | ||
| }; | ||
| } | ||
|
|
||
| function getExpectedCounts(expectedJobId: string) { | ||
| return { | ||
| job_id: expectedJobId, | ||
| processed_record_count: '0', | ||
| processed_field_count: '0', | ||
| input_bytes: '0.0 B', | ||
| input_field_count: '0', | ||
| invalid_date_count: '0', | ||
| missing_field_count: '0', | ||
| out_of_order_timestamp_count: '0', | ||
| empty_bucket_count: '0', | ||
| sparse_bucket_count: '0', | ||
| bucket_count: '0', | ||
| }; | ||
| } | ||
|
|
||
| function getExpectedModelSizeStats(expectedJobId: string) { | ||
| return { | ||
| job_id: expectedJobId, | ||
| result_type: 'model_size_stats', | ||
| total_by_field_count: '0', | ||
| total_over_field_count: '0', | ||
| total_partition_field_count: '0', | ||
| bucket_allocation_failures_count: '0', | ||
| memory_status: 'ok', | ||
| }; | ||
| } | ||
|
|
||
| describe('single metric without datafeed start', function () { | ||
| this.tags(['mlqa']); | ||
| before(async () => { | ||
| await esArchiver.loadIfNeeded('ml/farequote'); | ||
| await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp'); | ||
| await ml.testResources.setKibanaTimeZoneToUTC(); | ||
|
|
||
| await ml.securityUI.loginAsMlPowerUser(); | ||
| }); | ||
|
|
||
| after(async () => { | ||
| await ml.api.cleanMlIndices(); | ||
| }); | ||
|
|
||
| it('job creation loads the single metric wizard for the source data', async () => { | ||
| await ml.testExecution.logTestStep('job creation loads the job management page'); | ||
| await ml.navigation.navigateToMl(); | ||
| await ml.navigation.navigateToJobManagement(); | ||
|
|
||
| await ml.testExecution.logTestStep('job creation loads the new job source selection page'); | ||
| await ml.jobManagement.navigateToNewJobSourceSelection(); | ||
|
|
||
| await ml.testExecution.logTestStep('job creation loads the job type selection page'); | ||
| await ml.jobSourceSelection.selectSourceForAnomalyDetectionJob('ft_farequote'); | ||
|
|
||
| await ml.testExecution.logTestStep('job creation loads the single metric job wizard page'); | ||
| await ml.jobTypeSelection.selectSingleMetricJob(); | ||
| }); | ||
|
|
||
| it('job creation navigates through the single metric wizard and sets all needed fields', async () => { | ||
| await ml.testExecution.logTestStep('job creation displays the time range step'); | ||
| await ml.jobWizardCommon.assertTimeRangeSectionExists(); | ||
|
|
||
| await ml.testExecution.logTestStep('job creation sets the time range'); | ||
| await ml.jobWizardCommon.clickUseFullDataButton( | ||
| 'Feb 7, 2016 @ 00:00:00.000', | ||
| 'Feb 11, 2016 @ 23:59:54.000' | ||
| ); | ||
|
|
||
| await ml.testExecution.logTestStep('job creation displays the event rate chart'); | ||
| await ml.jobWizardCommon.assertEventRateChartExists(); | ||
| await ml.jobWizardCommon.assertEventRateChartHasData(); | ||
|
|
||
| await ml.testExecution.logTestStep('job creation displays the pick fields step'); | ||
| await ml.jobWizardCommon.advanceToPickFieldsSection(); | ||
|
|
||
| await ml.testExecution.logTestStep('job creation selects field and aggregation'); | ||
| await ml.jobWizardCommon.assertAggAndFieldInputExists(); | ||
| await ml.jobWizardCommon.selectAggAndField(aggAndFieldIdentifier, true); | ||
| await ml.jobWizardCommon.assertAnomalyChartExists('LINE'); | ||
|
|
||
| await ml.testExecution.logTestStep('job creation inputs the bucket span'); | ||
| await ml.jobWizardCommon.assertBucketSpanInputExists(); | ||
| await ml.jobWizardCommon.setBucketSpan(bucketSpan); | ||
|
|
||
| await ml.testExecution.logTestStep('job creation displays the job details step'); | ||
| await ml.jobWizardCommon.advanceToJobDetailsSection(); | ||
|
|
||
| await ml.testExecution.logTestStep('job creation inputs the job id'); | ||
| await ml.jobWizardCommon.assertJobIdInputExists(); | ||
| await ml.jobWizardCommon.setJobId(jobId); | ||
|
|
||
| await ml.testExecution.logTestStep('job creation displays the validation step'); | ||
| await ml.jobWizardCommon.advanceToValidationSection(); | ||
|
|
||
| await ml.testExecution.logTestStep('job creation displays the summary step'); | ||
| await ml.jobWizardCommon.advanceToSummarySection(); | ||
| }); | ||
|
|
||
| it('job creation runs the job and displays it correctly in the job list', async () => { | ||
darnautov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| await ml.testExecution.logTestStep('job creation creates the job and finishes processing'); | ||
|
|
||
| await ml.jobWizardCommon.assertStartDatafeedSwitchExists(); | ||
| await ml.jobWizardCommon.toggleStartDatafeedSwitch(false); | ||
|
|
||
| await ml.jobWizardCommon.assertCreateJobButtonExists(); | ||
| await ml.jobWizardCommon.createJobWithoutDatafeedStart(); | ||
|
|
||
| await ml.jobTable.waitForJobsToLoad(); | ||
| await ml.jobTable.filterWithSearchString(jobId, 1); | ||
|
|
||
| await ml.testExecution.logTestStep( | ||
| 'job creation displays details for the created job in the job list' | ||
| ); | ||
| await ml.jobTable.assertJobRowFields(jobId, getExpectedRow(jobId)); | ||
|
|
||
| await ml.jobTable.assertJobRowDetailsCounts( | ||
| jobId, | ||
| getExpectedCounts(jobId), | ||
| getExpectedModelSizeStats(jobId) | ||
| ); | ||
| }); | ||
| }); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.