[Ml] Rename `useNativeProcess` setting to `xpack.ml.autodetect_process` and un-deprecate it.

Original commit: elastic/x-pack-elasticsearch@eb2143e6f0
This commit is contained in:
Martijn van Groningen 2017-02-23 15:29:44 +01:00
parent 412d5e35b1
commit e7d56e92f8
4 changed files with 8 additions and 12 deletions

View File

@ -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<Boolean> USE_NATIVE_PROCESS_OPTION = Setting.boolSetting("useNativeProcess", true, Property.NodeScope,
Property.Deprecated);
public static final Setting<Boolean> AUTODETECT_PROCESS =
Setting.boolSetting("xpack.ml.autodetect_process", true, Property.NodeScope);
public static final Setting<Boolean> ML_ENABLED =
Setting.boolSetting("node.ml", XPackSettings.MACHINE_LEARNING_ENABLED, Setting.Property.NodeScope);
public static final Setting<Integer> CONCURRENT_JOB_ALLOCATIONS =
@ -173,7 +171,7 @@ public class MachineLearning extends Plugin implements ActionPlugin {
@Override
public List<Setting<?>> 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) {

View File

@ -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);

View File

@ -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());

View File

@ -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();
}