Load the mlmodel config file from the correct location (elastic/elasticsearch#4958)

There were two problems:

1. The location for the autodetect process was ES_HOME/config/ml
2. The location for the normalize process was its current working
   directory

In both cases the correct location is ES_HOME/config/x-pack

Original commit: elastic/x-pack-elasticsearch@7d8a384fda
This commit is contained in:
David Roberts 2017-02-10 15:19:47 +00:00 committed by GitHub
parent 299f9ab74b
commit 406741c2f8
2 changed files with 6 additions and 10 deletions

View File

@ -343,10 +343,6 @@ public class MlPlugin extends Plugin implements ActionPlugin {
);
}
public static Path resolveConfigFile(Environment env, String name) {
return env.configFile().resolve(NAME).resolve(name);
}
@Override
public List<ExecutorBuilder<?>> getExecutorBuilders(Settings settings) {
if (false == enabled) {

View File

@ -12,7 +12,7 @@ import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Setting.Property;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
import org.elasticsearch.xpack.ml.MlPlugin;
import org.elasticsearch.xpack.XPackPlugin;
import org.elasticsearch.xpack.ml.job.config.AnalysisConfig;
import org.elasticsearch.xpack.ml.job.config.DataDescription;
import org.elasticsearch.xpack.ml.job.config.IgnoreDowntime;
@ -225,7 +225,7 @@ public class ProcessCtrl {
}
if (modelConfigFilePresent(env)) {
String modelConfigFile = MlPlugin.resolveConfigFile(env, ML_MODEL_CONF).toString();
String modelConfigFile = XPackPlugin.resolveConfigFile(env, ML_MODEL_CONF).toString();
command.add(MODEL_CONFIG_ARG + modelConfigFile);
}
@ -250,7 +250,7 @@ public class ProcessCtrl {
* Return true if there is a file ES_HOME/config/mlmodel.conf
*/
public static boolean modelConfigFilePresent(Environment env) {
Path modelConfPath = MlPlugin.resolveConfigFile(env, ML_MODEL_CONF);
Path modelConfPath = XPackPlugin.resolveConfigFile(env, ML_MODEL_CONF);
return Files.isRegularFile(modelConfPath);
}
@ -279,8 +279,8 @@ public class ProcessCtrl {
}
if (modelConfigFilePresent(env)) {
Path modelConfPath = MlPlugin.resolveConfigFile(env, ML_MODEL_CONF);
command.add(MODEL_CONFIG_ARG + modelConfPath.toAbsolutePath().getFileName());
String modelConfigFile = XPackPlugin.resolveConfigFile(env, ML_MODEL_CONF).toString();
command.add(MODEL_CONFIG_ARG + modelConfigFile);
}
return command;
@ -297,7 +297,7 @@ public class ProcessCtrl {
Path stateFile = Files.createTempFile(env.tmpFile(), jobId + "_quantiles_" + Thread.currentThread().getId(),
QUANTILES_FILE_EXTENSION);
try (BufferedWriter osw = Files.newBufferedWriter(stateFile, StandardCharsets.UTF_8);) {
try (BufferedWriter osw = Files.newBufferedWriter(stateFile, StandardCharsets.UTF_8)) {
osw.write(state);
}