-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Clone analytics job #59791
Merged
Merged
[ML] Clone analytics job #59791
Changes from 4 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
ef9170c
[ML] clone analytics job
darnautov 86be82e
[ML] flyout clone header
darnautov 4923423
[ML] improve clone action context menu item
darnautov 307b32b
[ML] support advanced job cloning
darnautov d1356bc
[ML] extractCloningConfig
darnautov ba2cabd
[ML] fix isAdvancedSetting condition, add test
darnautov 9fc4fdb
[ML] clone job header
darnautov a667557
Merge remote-tracking branch 'upstream/master' into ML-clone-analytic…
darnautov 84deee6
[ML] job description placeholder
darnautov 6722186
[ML] setEstimatedModelMemoryLimit on source index change
darnautov e476f28
[ML] Fix types.
walterra ff14676
[ML] useUpdateEffect in create_analytics_form.tsx
darnautov 254daf4
[ML] setJobClone action
darnautov 09425ab
Merge pull request #1 from walterra/ML-clone-analytics-jobs
darnautov 2c180c1
[ML] remove CreateAnalyticsFlyoutWrapper instance from the create_ana…
darnautov 29ca176
Merge remote-tracking branch 'origin/ML-clone-analytics-jobs' into ML…
darnautov 9f05bb8
[ML] fix types
darnautov 458ec21
[ML] hack to align Clone button with the other actions
darnautov d3992a0
[ML] unknown props lead to advanced editor
darnautov 44cc41b
[ML] rename maximum_number_trees ot max_trees
darnautov 6b7d0bf
[ML] fix forceInput
darnautov 5939ddc
[ML] populate excludesOptions on the first update, skip setting mml o…
darnautov cac0b36
[ML] init functional test for cloning analytics jobs
darnautov fde5626
Merge remote-tracking branch 'upstream/master' into ML-clone-analytic…
darnautov a9b742a
[ML] functional tests
darnautov fee64e2
[ML] fix functional tests imports
darnautov 8c2968e
[ML] fix indices names for functional tests
darnautov bfd985b
[ML] functional tests for outlier detection and regression jobs cloning
darnautov 24d4b57
[ML] delete james tag
darnautov 526f88c
[ML] fix tests arrangement
darnautov 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
222 changes: 222 additions & 0 deletions
222
...frame_analytics/pages/analytics_management/components/analytics_list/action_clone.test.ts
This file contains 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,222 @@ | ||
/* | ||
* 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 { isAdvancedConfig } from './action_clone'; | ||
|
||
describe('Analytics job clone action', () => { | ||
describe('isAdvancedConfig', () => { | ||
test('should detect a classification job created with the form', () => { | ||
const formCreatedClassificationJob = { | ||
id: 'bank_classification_1', | ||
description: "Classification job with 'bank-marketing' dataset", | ||
source: { | ||
index: ['bank-marketing'], | ||
query: { | ||
match_all: {}, | ||
}, | ||
}, | ||
dest: { | ||
index: 'dest_bank_1', | ||
results_field: 'ml', | ||
}, | ||
analysis: { | ||
classification: { | ||
dependent_variable: 'y', | ||
num_top_classes: 2, | ||
prediction_field_name: 'y_prediction', | ||
training_percent: 2, | ||
randomize_seed: 6233212276062807000, | ||
}, | ||
}, | ||
analyzed_fields: { | ||
includes: [], | ||
excludes: [], | ||
}, | ||
model_memory_limit: '350mb', | ||
create_time: 1583417086689, | ||
version: '8.0.0', | ||
allow_lazy_start: false, | ||
}; | ||
|
||
expect(isAdvancedConfig(formCreatedClassificationJob)).toBe(false); | ||
}); | ||
|
||
test('should detect a outlier_detection job created with the form', () => { | ||
const formCreatedOutlierDetectionJob = { | ||
id: 'glass_outlier_detection_1', | ||
description: "Outlier detection job with 'glass' dataset", | ||
source: { | ||
index: ['glass_withoutdupl_norm'], | ||
query: { | ||
match_all: {}, | ||
}, | ||
}, | ||
dest: { | ||
index: 'dest_glass_1', | ||
results_field: 'ml', | ||
}, | ||
analysis: { | ||
outlier_detection: { | ||
compute_feature_influence: true, | ||
outlier_fraction: 0.05, | ||
standardization_enabled: true, | ||
}, | ||
}, | ||
analyzed_fields: { | ||
includes: [], | ||
excludes: ['id', 'outlier'], | ||
}, | ||
model_memory_limit: '1mb', | ||
create_time: 1583417347446, | ||
version: '8.0.0', | ||
allow_lazy_start: false, | ||
}; | ||
expect(isAdvancedConfig(formCreatedOutlierDetectionJob)).toBe(false); | ||
}); | ||
|
||
test('should detect a regression job created with the form', () => { | ||
const formCreatedRegressionJob = { | ||
id: 'grid_regression_1', | ||
description: "Regression job with 'electrical-grid-stability' dataset", | ||
source: { | ||
index: ['electrical-grid-stability'], | ||
query: { | ||
match_all: {}, | ||
}, | ||
}, | ||
dest: { | ||
index: 'dest_grid_1', | ||
results_field: 'ml', | ||
}, | ||
analysis: { | ||
regression: { | ||
dependent_variable: 'stab', | ||
prediction_field_name: 'stab_prediction', | ||
training_percent: 20, | ||
randomize_seed: -2228827740028660200, | ||
}, | ||
}, | ||
analyzed_fields: { | ||
includes: [], | ||
excludes: [], | ||
}, | ||
model_memory_limit: '150mb', | ||
create_time: 1583417178919, | ||
version: '8.0.0', | ||
allow_lazy_start: false, | ||
}; | ||
|
||
expect(isAdvancedConfig(formCreatedRegressionJob)).toBe(false); | ||
}); | ||
|
||
test('should detect advanced classification job', () => { | ||
const advancedClassificationJob = { | ||
id: 'bank_classification_1', | ||
description: "Classification job with 'bank-marketing' dataset", | ||
source: { | ||
index: ['bank-marketing'], | ||
query: { | ||
match_all: {}, | ||
}, | ||
}, | ||
dest: { | ||
index: 'dest_bank_1', | ||
results_field: 'CUSTOM_RESULT_FIELD', | ||
}, | ||
analysis: { | ||
classification: { | ||
dependent_variable: 'y', | ||
num_top_classes: 2, | ||
prediction_field_name: 'y_prediction', | ||
training_percent: 2, | ||
randomize_seed: 6233212276062807000, | ||
}, | ||
}, | ||
analyzed_fields: { | ||
includes: [], | ||
excludes: [], | ||
}, | ||
model_memory_limit: '350mb', | ||
create_time: 1583417086689, | ||
version: '8.0.0', | ||
allow_lazy_start: false, | ||
}; | ||
|
||
expect(isAdvancedConfig(advancedClassificationJob)).toBe(true); | ||
}); | ||
|
||
test('should detect advanced outlier_detection job', () => { | ||
const advancedOutlierDetectionJob = { | ||
id: 'glass_outlier_detection_1', | ||
description: "Outlier detection job with 'glass' dataset", | ||
source: { | ||
index: ['glass_withoutdupl_norm'], | ||
query: { | ||
// TODO check default for `match` | ||
match_all: {}, | ||
}, | ||
}, | ||
dest: { | ||
index: 'dest_glass_1', | ||
results_field: 'ml', | ||
}, | ||
analysis: { | ||
outlier_detection: { | ||
compute_feature_influence: false, | ||
outlier_fraction: 0.05, | ||
standardization_enabled: true, | ||
}, | ||
}, | ||
analyzed_fields: { | ||
includes: [], | ||
excludes: ['id', 'outlier'], | ||
}, | ||
model_memory_limit: '1mb', | ||
create_time: 1583417347446, | ||
version: '8.0.0', | ||
allow_lazy_start: false, | ||
}; | ||
expect(isAdvancedConfig(advancedOutlierDetectionJob)).toBe(true); | ||
}); | ||
|
||
test('should detect advanced regression job', () => { | ||
const advancedRegressionJob = { | ||
id: 'grid_regression_1', | ||
description: "Regression job with 'electrical-grid-stability' dataset", | ||
source: { | ||
index: ['electrical-grid-stability'], | ||
query: { | ||
match: { | ||
custom_field: 'custom_match', | ||
}, | ||
}, | ||
}, | ||
dest: { | ||
index: 'dest_grid_1', | ||
results_field: 'ml', | ||
}, | ||
analysis: { | ||
regression: { | ||
dependent_variable: 'stab', | ||
prediction_field_name: 'stab_prediction', | ||
training_percent: 20, | ||
randomize_seed: -2228827740028660200, | ||
}, | ||
}, | ||
analyzed_fields: { | ||
includes: [], | ||
excludes: [], | ||
}, | ||
model_memory_limit: '150mb', | ||
create_time: 1583417178919, | ||
version: '8.0.0', | ||
allow_lazy_start: false, | ||
}; | ||
|
||
expect(isAdvancedConfig(advancedRegressionJob)).toBe(true); | ||
}); | ||
}); | ||
}); |
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.
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.
Did you mean to leave in this comment?
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 noticed one of the outlier detection jobs (created by env bootstrap) has query
match
instead ofmatch_all
. As I saw in all the other casesmatch_all
is a default, so probably it's just a typo in a bootstrap job.