From d1bf5d83add81aba806f57441543c43d79cf226e Mon Sep 17 00:00:00 2001 From: David Roberts Date: Thu, 24 Nov 2016 22:21:17 +0000 Subject: [PATCH] Remove prelert_ prefix from programs to fit what Elasticsearch expects (elastic/elasticsearch#332) Elasticsearch will now attempt to spawn a controller daemon called simply `controller` when it starts up, but ours was called `prelert_controller`. For consistency it makes sense to remove the prefix from all our programs. Original commit: elastic/x-pack-elasticsearch@d06714b2310c6b76b1b4b35d3e3b8ff9935d3e34 --- .../xpack/prelert/job/process/ProcessCtrl.java | 10 +++++----- .../xpack/prelert/job/process/ProcessPipes.java | 4 ++-- .../process/autodetect/writer/FieldConfigWriter.java | 3 +-- .../prelert/job/logging/CppLogMessageHandlerTests.java | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/process/ProcessCtrl.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/process/ProcessCtrl.java index 8902890ed89..a27e5826ce7 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/process/ProcessCtrl.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/process/ProcessCtrl.java @@ -37,19 +37,19 @@ public class ProcessCtrl { /** * Autodetect API native program name - always loaded from the same directory as the controller process */ - public static final String AUTODETECT = "prelert_autodetect"; + public static final String AUTODETECT = "autodetect"; static final String AUTODETECT_PATH = "./" + AUTODETECT; /** * The normalisation native program name - always loaded from the same directory as the controller process */ - public static final String NORMALIZE = "prelert_normalize"; + public static final String NORMALIZE = "normalize"; static final String NORMALIZE_PATH = "./" + NORMALIZE; /** * Process controller native program name */ - public static final String CONTROLLER = "prelert_controller"; + public static final String CONTROLLER = "controller"; /** * Name of the config setting containing the path to the logs directory @@ -73,7 +73,7 @@ public class ProcessCtrl { static final String LICENSE_VALIDATION_ARG = "--licenseValidation="; /* - * Arguments used by both prelert_autodetect and prelert_normalize + * Arguments used by both autodetect and normalize */ static final String BUCKET_SPAN_ARG = "--bucketspan="; public static final String DELETE_STATE_FILES_ARG = "--deleteStateFiles"; @@ -85,7 +85,7 @@ public class ProcessCtrl { static final String PER_PARTITION_NORMALIZATION = "--perPartitionNormalization"; /* - * Arguments used by prelert_autodetect + * Arguments used by autodetect */ static final String BATCH_SPAN_ARG = "--batchspan="; static final String LATENCY_ARG = "--latency="; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/process/ProcessPipes.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/process/ProcessPipes.java index 1ed9c7a03c7..8d3a881c562 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/process/ProcessPipes.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/process/ProcessPipes.java @@ -69,9 +69,9 @@ public class ProcessPipes { boolean wantRestorePipe, boolean wantPersistPipe) { this.namedPipeHelper = namedPipeHelper; - // The way the pipe names are formed MUST match what is done in the prelert_controller main() + // The way the pipe names are formed MUST match what is done in the controller main() // function, as it does not get any command line arguments when started as a daemon. If - // you change the code here then you MUST also change the C++ code in prelert_controller's + // you change the code here then you MUST also change the C++ code in controller's // main() function. StringBuilder prefixBuilder = new StringBuilder(); prefixBuilder.append(namedPipeHelper.getDefaultPipeDirectoryPrefix(env)).append(Objects.requireNonNull(processName)).append('_'); diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/process/autodetect/writer/FieldConfigWriter.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/process/autodetect/writer/FieldConfigWriter.java index 1d7ee712093..a84568537d9 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/process/autodetect/writer/FieldConfigWriter.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/process/autodetect/writer/FieldConfigWriter.java @@ -35,8 +35,7 @@ public class FieldConfigWriter { private static final String LIST_PREFIX = "list."; // Note: for the Engine API summarycountfield is currently passed as a - // command line option to prelert_autodetect rather than in the field - // config file + // command line option to autodetect rather than in the field config file private static final char NEW_LINE = '\n'; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/job/logging/CppLogMessageHandlerTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/job/logging/CppLogMessageHandlerTests.java index 8596347d95e..08de6a87e17 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/job/logging/CppLogMessageHandlerTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/job/logging/CppLogMessageHandlerTests.java @@ -24,10 +24,10 @@ public class CppLogMessageHandlerTests extends ESTestCase { + "\"method\":\"core::CLogger::reconfigureFromProps\",\"file\":\"CLogger.cc\",\"line\":452}\n" + "{\"logger\":\"controller\",\"timestamp\":1478261151445,\"level\":\"DEBUG\",\"pid\":10211,\"thread\":\"0x7fff7d2a8000\"," + "\"message\":\"Logger is logging to named pipe " - + "/var/folders/k5/5sqcdlps5sg3cvlp783gcz740000h0/T/prelert_controller_log_784\",\"class\":\"prelert\"," + + "/var/folders/k5/5sqcdlps5sg3cvlp783gcz740000h0/T/controller_log_784\",\"class\":\"prelert\"," + "\"method\":\"core::CLogger::reconfigureLogToNamedPipe\",\"file\":\"CLogger.cc\",\"line\":333}\n" + "{\"logger\":\"controller\",\"timestamp\":1478261151445,\"level\":\"INFO\",\"pid\":10211,\"thread\":\"0x7fff7d2a8000\"," - + "\"message\":\"prelert_controller (64 bit): Version based on 6.5.0 (Build DEVELOPMENT BUILD by dave) " + + "\"message\":\"controller (64 bit): Version based on 6.5.0 (Build DEVELOPMENT BUILD by dave) " + "Copyright (c) Prelert Ltd 2006-2016\",\"method\":\"main\",\"file\":\"Main.cc\",\"line\":123}\n" + "{\"logger\":\"controller\",\"timestamp\":1478261169065,\"level\":\"ERROR\",\"pid\":10211,\"thread\":\"0x7fff7d2a8000\"," + "\"message\":\"Did not understand verb 'a'\",\"class\":\"prelert\","