From e7d56e92f8426f0bfe220c9216fd42bdae2b0617 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Thu, 23 Feb 2017 15:29:44 +0100 Subject: [PATCH] [Ml] Rename `useNativeProcess` setting to `xpack.ml.autodetect_process` and un-deprecate it. Original commit: elastic/x-pack-elasticsearch@eb2143e6f01101a6e2a0af792c88b685f907b189 --- .../org/elasticsearch/xpack/ml/MachineLearning.java | 10 ++++------ .../xpack/ml/job/persistence/JobProvider.java | 4 +--- .../xpack/ml/job/process/NativeControllerHolder.java | 4 ++-- .../xpack/ml/support/BaseMlIntegTestCase.java | 2 +- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java index 0dda4f21347..ab2f4b3a7f2 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java @@ -145,10 +145,8 @@ public class MachineLearning extends Plugin implements ActionPlugin { public static final String DATAFEED_RUNNER_THREAD_POOL_NAME = NAME + "_datafeed_runner"; public static final String AUTODETECT_PROCESS_THREAD_POOL_NAME = NAME + "_autodetect_process"; - // NORELEASE - temporary solution - public static final Setting USE_NATIVE_PROCESS_OPTION = Setting.boolSetting("useNativeProcess", true, Property.NodeScope, - Property.Deprecated); - + public static final Setting AUTODETECT_PROCESS = + Setting.boolSetting("xpack.ml.autodetect_process", true, Property.NodeScope); public static final Setting ML_ENABLED = Setting.boolSetting("node.ml", XPackSettings.MACHINE_LEARNING_ENABLED, Setting.Property.NodeScope); public static final Setting CONCURRENT_JOB_ALLOCATIONS = @@ -173,7 +171,7 @@ public class MachineLearning extends Plugin implements ActionPlugin { @Override public List> getSettings() { return Collections.unmodifiableList( - Arrays.asList(USE_NATIVE_PROCESS_OPTION, + Arrays.asList(AUTODETECT_PROCESS, ML_ENABLED, CONCURRENT_JOB_ALLOCATIONS, ProcessCtrl.DONT_PERSIST_MODEL_STATE_SETTING, @@ -257,7 +255,7 @@ public class MachineLearning extends Plugin implements ActionPlugin { JobManager jobManager = new JobManager(settings, jobProvider, jobResultsPersister, clusterService); AutodetectProcessFactory autodetectProcessFactory; NormalizerProcessFactory normalizerProcessFactory; - if (USE_NATIVE_PROCESS_OPTION.get(settings)) { + if (AUTODETECT_PROCESS.get(settings)) { try { NativeController nativeController = NativeControllerHolder.getNativeController(settings); if (nativeController == null) { diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobProvider.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobProvider.java index 32a91b72442..af6e11e6031 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobProvider.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobProvider.java @@ -18,7 +18,6 @@ import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.action.get.GetRequest; import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.get.MultiGetAction; import org.elasticsearch.action.get.MultiGetItemResponse; import org.elasticsearch.action.get.MultiGetRequest; import org.elasticsearch.action.search.MultiSearchRequest; @@ -62,7 +61,6 @@ import org.elasticsearch.xpack.ml.action.DeleteJobAction; import org.elasticsearch.xpack.ml.action.util.QueryPage; import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.config.MlFilter; -import org.elasticsearch.xpack.ml.job.messages.Messages; import org.elasticsearch.xpack.ml.job.persistence.BucketsQueryBuilder.BucketsQuery; import org.elasticsearch.xpack.ml.job.persistence.InfluencersQueryBuilder.InfluencersQuery; import org.elasticsearch.xpack.ml.job.process.autodetect.state.CategorizerState; @@ -141,7 +139,7 @@ public class JobProvider { this.settings = settings; // Whether we are using native process is a good way to detect whether we are in dev / test mode: - if (MachineLearning.USE_NATIVE_PROCESS_OPTION.get(settings)) { + if (MachineLearning.AUTODETECT_PROCESS.get(settings)) { delayedNodeTimeOutSetting = UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.get(settings); } else { delayedNodeTimeOutSetting = TimeValue.timeValueNanos(0); diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/job/process/NativeControllerHolder.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/job/process/NativeControllerHolder.java index b67c0a9fcc2..66502d2ff16 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/job/process/NativeControllerHolder.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/job/process/NativeControllerHolder.java @@ -29,13 +29,13 @@ public class NativeControllerHolder { * * The NativeController is created lazily to allow time for the C++ process to be started before connection is attempted. * - * null is returned to tests that haven't bothered to set up path.home and all runs where useNativeProcess=false. + * null is returned to tests that haven't bothered to set up path.home and all runs where xpack.ml.autodetect_process=false. * * Calls may throw an exception if initial connection to the C++ process fails. */ public static NativeController getNativeController(Settings settings) throws IOException { - if (Environment.PATH_HOME_SETTING.exists(settings) && MachineLearning.USE_NATIVE_PROCESS_OPTION.get(settings)) { + if (Environment.PATH_HOME_SETTING.exists(settings) && MachineLearning.AUTODETECT_PROCESS.get(settings)) { synchronized (lock) { if (nativeController == null) { nativeController = new NativeController(new Environment(settings), new NamedPipeHelper()); diff --git a/plugin/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java b/plugin/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java index 51ed91426a1..fce95ab713b 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java @@ -64,7 +64,7 @@ public abstract class BaseMlIntegTestCase extends SecurityIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { Settings.Builder settings = Settings.builder().put(super.nodeSettings(nodeOrdinal)); - settings.put(MachineLearning.USE_NATIVE_PROCESS_OPTION.getKey(), false); + settings.put(MachineLearning.AUTODETECT_PROCESS.getKey(), false); settings.put(XPackSettings.MACHINE_LEARNING_ENABLED.getKey(), true); return settings.build(); }