-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[ML] Migrate unallocated jobs and datafeeds #37430
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
Merged
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ac947db
Block assignment of open jobs until they have been migrated
davidkyle 6fa88e0
Migrate unallocated jobs
davidkyle 0d82d6e
Update task params
davidkyle 152f299
Update datafeed task
davidkyle 465255a
Tests for updating persistent task parameters
davidkyle b13fc1c
Migration eligibility checks
davidkyle 13bbcca
Remove unused code
davidkyle 5c0739b
Hide empty lists of jobs and data feeds in mlmetadata
davidkyle c0d7614
Address review comments
davidkyle a3d0c2c
Fix test assertion
davidkyle b63c9c7
Use task builder
davidkyle 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
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -6,14 +6,16 @@ | |||||
|
|
||||||
| package org.elasticsearch.xpack.core.ml; | ||||||
|
|
||||||
| import org.elasticsearch.cluster.node.DiscoveryNodes; | ||||||
| import org.elasticsearch.common.Nullable; | ||||||
| import org.elasticsearch.persistent.PersistentTasksClusterService; | ||||||
| import org.elasticsearch.persistent.PersistentTasksCustomMetaData; | ||||||
| import org.elasticsearch.xpack.core.ml.datafeed.DatafeedState; | ||||||
| import org.elasticsearch.xpack.core.ml.job.config.JobState; | ||||||
| import org.elasticsearch.xpack.core.ml.job.config.JobTaskState; | ||||||
|
|
||||||
| import java.util.Collection; | ||||||
| import java.util.Collections; | ||||||
| import java.util.List; | ||||||
| import java.util.Set; | ||||||
| import java.util.stream.Collectors; | ||||||
|
|
||||||
|
|
@@ -133,6 +135,42 @@ public static Set<String> openJobIds(@Nullable PersistentTasksCustomMetaData tas | |||||
| .collect(Collectors.toSet()); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Get the job Ids of anomaly detector job tasks that do | ||||||
| * not have an assignment. | ||||||
| * | ||||||
| * @param tasks Persistent tasks. If null an empty set is returned. | ||||||
| * @param nodes The cluster nodes | ||||||
| * @return The job Ids of tasks to do not have an assignment. | ||||||
| */ | ||||||
| public static Set<String> unallocatedJobIds(@Nullable PersistentTasksCustomMetaData tasks, | ||||||
| DiscoveryNodes nodes) { | ||||||
| return unallocatedJobTasks(tasks, nodes).stream() | ||||||
| .map(task ->task.getId().substring(JOB_TASK_ID_PREFIX.length())) | ||||||
| .collect(Collectors.toSet()); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * The job tasks that do not have an allocation as determined by | ||||||
| * {@link PersistentTasksClusterService#needsReassignment(PersistentTasksCustomMetaData.Assignment, DiscoveryNodes)} | ||||||
| * | ||||||
| * @param tasks Persistent tasks. If null an empty set is returned. | ||||||
| * @param nodes The cluster nodes | ||||||
| * @return Unallocated job tasks | ||||||
| */ | ||||||
| public static Collection<PersistentTasksCustomMetaData.PersistentTask> unallocatedJobTasks( | ||||||
| @Nullable PersistentTasksCustomMetaData tasks, | ||||||
| DiscoveryNodes nodes) { | ||||||
| if (tasks == null) { | ||||||
| return Collections.emptySet(); | ||||||
|
||||||
| return Collections.emptySet(); | |
| return Collections.emptyList(); |
Outdated
Member
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.
#nit so that the collection type is the same as the return below.
Suggested change
| return Collections.emptySet(); | |
| return Collections.emptyList(); |
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
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.
#nit
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 would be the macbook butterfly keyboard. Thanks apple I don't need the space bar much