-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Introduce formal node ML role #45174
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
Changes from all commits
0ce5add
564a5d2
49e658f
f2058d3
5d7d703
c7122e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |
| import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; | ||
| import org.elasticsearch.cluster.metadata.IndexTemplateMetaData; | ||
| import org.elasticsearch.cluster.node.DiscoveryNode; | ||
| import org.elasticsearch.cluster.node.DiscoveryNodeRole; | ||
| import org.elasticsearch.cluster.node.DiscoveryNodes; | ||
| import org.elasticsearch.cluster.routing.UnassignedInfo; | ||
| import org.elasticsearch.cluster.service.ClusterService; | ||
|
|
@@ -280,6 +281,7 @@ | |
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Set; | ||
| import java.util.function.Supplier; | ||
| import java.util.function.UnaryOperator; | ||
|
|
||
|
|
@@ -300,6 +302,21 @@ public class MachineLearning extends Plugin implements ActionPlugin, AnalysisPlu | |
|
|
||
| public static final Setting<Boolean> ML_ENABLED = | ||
| Setting.boolSetting("node.ml", XPackSettings.MACHINE_LEARNING_ENABLED, Property.NodeScope); | ||
|
|
||
| public static final DiscoveryNodeRole ML_ROLE = new DiscoveryNodeRole("ml", "l") { | ||
|
|
||
| @Override | ||
| protected Setting<Boolean> roleSetting() { | ||
| return ML_ENABLED; | ||
| } | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Excessive blank line
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have very little in the way of style agreements, mostly what is enforced by checkstyle and a few loosely-enforced guidelines. We've discussed over the years adding an auto-formatter to avoid style issues once and for all, but we've not had the time to invest in it. Until then, we've mostly left style up to individual developers, although for particularly contentious issues we can have discussions amongst the teams that work in this codebase to see if we want to formalize a rule. Regarding this specific one, our codebase is inconsistently full of white space or not between the opening brace of a class and its body, and the closing brace of a class and its body. My preference is to have this whitespace.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the explanation. +1 for the idea of automated formatting some day... |
||
| }; | ||
|
|
||
| @Override | ||
| public Set<DiscoveryNodeRole> getRoles() { | ||
| return Collections.singleton(ML_ROLE); | ||
| } | ||
|
|
||
| // This is not used in v7 and higher, but users are still prevented from setting it directly to avoid confusion | ||
| private static final String PRE_V7_ML_ENABLED_NODE_ATTR = "ml.enabled"; | ||
| public static final String MAX_OPEN_JOBS_NODE_ATTR = "ml.max_open_jobs"; | ||
|
|
||
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.
Line 101 of this file has the old
mdiordering.Also, is it worth adding
lto the docs on line 101 or is it deliberate to leave roles added by modules out of the table?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.
Let's leave tweaking that to a possible follow-up, as it would include adding voting-only nodes too.