This is an automated email from the ASF dual-hosted git repository.
xhsun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 4694f67 Skip pipeline validation when disabling it (#4240)
4694f67 is described below
commit 4694f67d45c99e27ee5757da077cbee27f6eaf54
Author: Xiaohui Sun <[email protected]>
AuthorDate: Tue May 28 11:46:15 2019 -0700
Skip pipeline validation when disabling it (#4240)
* update ThirdEye metrics/dataset from UMP metadata
* Lazy saving metrics/datasets. & Fix style validation issues.
---
.../thirdeye/detection/yaml/YamlResource.java | 28 +++++++++++++++-------
1 file changed, 19 insertions(+), 9 deletions(-)
diff --git
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlResource.java
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlResource.java
index a60116f..430bf2a 100644
---
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlResource.java
+++
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlResource.java
@@ -160,7 +160,7 @@ public class YamlResource {
try {
translator = this.translatorLoader.from(yamlConfig, this.provider);
} catch (Exception e) {
- throw new IllegalArgumentException("Unable to instantiate the detection
pipeline. Please verify the pipelineType.", e);
+ throw new IllegalArgumentException("Unable to instantiate the detection
pipeline.", e);
}
return translator.withTuningWindow(tuningStartTime, tuningEndTime)
.withExistingDetectionConfig(existingDetectionConfig)
@@ -343,14 +343,24 @@ public class YamlResource {
// Translate config from YAML to detection config (JSON)
TreeMap<String, Object> newDetectionConfigMap = new
TreeMap<>(String.CASE_INSENSITIVE_ORDER);
newDetectionConfigMap.putAll(ConfigUtils.getMap(this.yaml.load(yamlDetectionConfig)));
- detectionConfig = buildDetectionConfigFromYaml(startTime, endTime,
newDetectionConfigMap, existingDetectionConfig);
- detectionConfig.setYaml(yamlDetectionConfig);
-
- // Validate updated config before saving it
- detectionValidator.validateUpdatedConfig(detectionConfig,
existingDetectionConfig);
- // Save the detection config
- Long id = this.detectionConfigDAO.save(detectionConfig);
- Preconditions.checkNotNull(id, "Error while saving the detection
pipeline");
+ try {
+ detectionConfig = buildDetectionConfigFromYaml(startTime, endTime,
newDetectionConfigMap, existingDetectionConfig);
+ detectionConfig.setYaml(yamlDetectionConfig);
+
+ // Validate updated config before saving it
+ detectionValidator.validateUpdatedConfig(detectionConfig,
existingDetectionConfig);
+ // Save the detection config
+ Long id = this.detectionConfigDAO.save(detectionConfig);
+ Preconditions.checkNotNull(id, "Error while saving the detection
pipeline");
+ } finally {
+ // If it is to disable the pipeline then no need to do validation and
parsing.
+ // It is possible that the metric or dataset was deleted so the
validation will fail.
+ if (!MapUtils.getBooleanValue(newDetectionConfigMap, PROP_ACTIVE, true))
{
+ existingDetectionConfig.setActive(false);
+ existingDetectionConfig.setYaml(yamlDetectionConfig);
+ this.detectionConfigDAO.save(existingDetectionConfig);
+ }
+ }
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]