-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Refactor ProcessCtrl into Autodetect and Normalizer builders (#3…
…2720) This moves the helper functionality for creating the autodetect and mormalizer processes into corresponding builders.
- Loading branch information
1 parent
f72cf57
commit 3db5292
Showing
12 changed files
with
484 additions
and
434 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...k/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/ProcessBuilderUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
package org.elasticsearch.xpack.ml.job.process; | ||
|
||
import org.elasticsearch.common.unit.TimeValue; | ||
import org.elasticsearch.env.Environment; | ||
import org.elasticsearch.xpack.core.XPackPlugin; | ||
|
||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.util.List; | ||
|
||
public final class ProcessBuilderUtils { | ||
|
||
private ProcessBuilderUtils() {} | ||
|
||
/** | ||
* Name of the model config file | ||
*/ | ||
public static final String ML_MODEL_CONF = "mlmodel.conf"; | ||
|
||
public static <T> void addIfNotNull(T object, String argKey, List<String> command) { | ||
if (object != null) { | ||
String param = argKey + object; | ||
command.add(param); | ||
} | ||
} | ||
|
||
public static void addIfNotNull(TimeValue timeValue, String argKey, List<String> command) { | ||
addIfNotNull(timeValue == null ? null : timeValue.getSeconds(), argKey, command); | ||
} | ||
|
||
/** | ||
* Return true if there is a file ES_HOME/config/mlmodel.conf | ||
*/ | ||
public static boolean modelConfigFilePresent(Environment env) { | ||
Path modelConfPath = XPackPlugin.resolveConfigFile(env, ML_MODEL_CONF); | ||
|
||
return Files.isRegularFile(modelConfPath); | ||
} | ||
} |
289 changes: 0 additions & 289 deletions
289
x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/ProcessCtrl.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.