This is an automated email from the ASF dual-hosted git repository. akshayrai09 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 46f67a4 [TE] Retain status of inactive functions (#3803) 46f67a4 is described below commit 46f67a4bad2691f198ef7e23601c2a8936a4d659 Author: Akshay Rai <akshayra...@gmail.com> AuthorDate: Thu Feb 7 16:40:23 2019 -0800 [TE] Retain status of inactive functions (#3803) --- .../apache/pinot/thirdeye/detection/DetectionMigrationResource.java | 6 +++--- .../thirdeye/detection/yaml/CompositePipelineConfigTranslator.java | 2 +- .../thirdeye/detection/yaml/YamlDetectionConfigTranslator.java | 1 - .../pinot/thirdeye/detection/migrated-detection-config-1.json | 2 +- .../pinot/thirdeye/detection/migrated-detection-config-2.json | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/DetectionMigrationResource.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/DetectionMigrationResource.java index f9e7c96..795e917 100644 --- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/DetectionMigrationResource.java +++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/DetectionMigrationResource.java @@ -119,6 +119,7 @@ public class DetectionMigrationResource { yamlConfigs.put("detectionName", anomalyFunctionDTO.getFunctionName()); yamlConfigs.put("description", "<Please edit and provide a description for this alert>"); yamlConfigs.put("metric", anomalyFunctionDTO.getMetric()); + yamlConfigs.put("active", anomalyFunctionDTO.getIsActive()); yamlConfigs.put("dataset", anomalyFunctionDTO.getCollection()); yamlConfigs.put("pipelineType", "Composite"); if (StringUtils.isNotBlank(anomalyFunctionDTO.getExploreDimensions())) { @@ -586,6 +587,7 @@ public class DetectionMigrationResource { validateFunction(func); } catch (ValidationException e) { LOGGER.info("[MIG] Function failed validation. Name " + func.getFunctionName() + " Error : " + e.getMessage()); + responseMessage.put("Failed to migrate " + func.getId(), String.format("Validation Error : %s", e.getMessage())); continue; } @@ -593,9 +595,7 @@ public class DetectionMigrationResource { migrateLegacyAnomalyFunction(func); } catch (Exception e) { // Skip migrating this function and move on to the next - responseMessage.put("Status of function " + func.getId(), - String.format("Failed to migrate function ID %d with name %s due to %s", func.getId(), - func.getFunctionName(), e.getMessage())); + responseMessage.put("Failed to migrate " + func.getId(), String.format("Error : %s", e.getMessage())); } } diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/CompositePipelineConfigTranslator.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/CompositePipelineConfigTranslator.java index 0151c08..9c7febb 100644 --- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/CompositePipelineConfigTranslator.java +++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/CompositePipelineConfigTranslator.java @@ -213,7 +213,7 @@ public class CompositePipelineConfigTranslator extends YamlDetectionConfigTransl List<Map<String, Object>> filterYamls = ConfigUtils.getList(ruleYaml.get(PROP_FILTER)); List<Map<String, Object>> detectionYamls = ConfigUtils.getList(ruleYaml.get(PROP_DETECTION)); List<Map<String, Object>> detectionProperties = buildListOfMergeWrapperProperties(detectionYamls); - if (filterYamls == null || filterYamls.isEmpty()) { + if (filterYamls.isEmpty()) { nestedPipelines.addAll(detectionProperties); } else { List<Map<String, Object>> filterNestedProperties = detectionProperties; diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlDetectionConfigTranslator.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlDetectionConfigTranslator.java index 69ca5c8..52ccd4b 100644 --- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlDetectionConfigTranslator.java +++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlDetectionConfigTranslator.java @@ -82,7 +82,6 @@ public abstract class YamlDetectionConfigTranslator { config.setName(MapUtils.getString(yamlConfig, PROP_NAME)); config.setDescription(MapUtils.getString(yamlConfig, PROP_DESC_NAME)); config.setLastTimestamp(System.currentTimeMillis()); - config.setActive(true); YamlTranslationResult translationResult = translateYaml(); Preconditions.checkArgument(!translationResult.getProperties().isEmpty(), "Empty detection property"); config.setProperties(translationResult.getProperties()); diff --git a/thirdeye/thirdeye-pinot/src/test/resources/org/apache/pinot/thirdeye/detection/migrated-detection-config-1.json b/thirdeye/thirdeye-pinot/src/test/resources/org/apache/pinot/thirdeye/detection/migrated-detection-config-1.json index 3f39305..15eb6a5 100644 --- a/thirdeye/thirdeye-pinot/src/test/resources/org/apache/pinot/thirdeye/detection/migrated-detection-config-1.json +++ b/thirdeye/thirdeye-pinot/src/test/resources/org/apache/pinot/thirdeye/detection/migrated-detection-config-1.json @@ -30,7 +30,7 @@ ] }, "active":true, - "yaml":"detectionName: test_function\ndescription: <Please edit and provide a description for this alert>\nmetric: test_metric\ndataset: test_collection\npipelineType: Composite\ndimensionExploration:\n dimensions:\n - platform\nfilters:\n platform:\n - desktop\n - tablet\nrules:\n- detection:\n - name: detection_rule1\n type: PERCENTAGE_RULE\n params:\n percentageChange: 0.05\n pattern: DOWN\n", + "yaml":"detectionName: test_function\ndescription: <Please edit and provide a description for this alert>\nmetric: test_metric\nactive: true\ndataset: test_collection\npipelineType: Composite\ndimensionExploration:\n dimensions:\n - platform\nfilters:\n platform:\n - desktop\n - tablet\nrules:\n- detection:\n - name: detection_rule1\n type: PERCENTAGE_RULE\n params:\n percentageChange: 0.05\n pattern: DOWN\n", "componentSpecs":{ "detection_rule1:PERCENTAGE_RULE":{ "percentageChange":0.05, diff --git a/thirdeye/thirdeye-pinot/src/test/resources/org/apache/pinot/thirdeye/detection/migrated-detection-config-2.json b/thirdeye/thirdeye-pinot/src/test/resources/org/apache/pinot/thirdeye/detection/migrated-detection-config-2.json index e08ffdb..960dcd6 100644 --- a/thirdeye/thirdeye-pinot/src/test/resources/org/apache/pinot/thirdeye/detection/migrated-detection-config-2.json +++ b/thirdeye/thirdeye-pinot/src/test/resources/org/apache/pinot/thirdeye/detection/migrated-detection-config-2.json @@ -27,7 +27,7 @@ ] }, "active":true, - "yaml":"detectionName: test_function\ndescription: <Please edit and provide a description for this alert>\nmetric: test_metric\ndataset: test_collection\npipelineType: Composite\nfilters:\n score_challenge_type:\n - Captcha Challenge\nrules:\n- detection:\n - name: detection_rule1\n type: THRESHOLD\n params:\n min: '0.70'\n", + "yaml":"detectionName: test_function\ndescription: <Please edit and provide a description for this alert>\nmetric: test_metric\nactive: true\ndataset: test_collection\npipelineType: Composite\nfilters:\n score_challenge_type:\n - Captcha Challenge\nrules:\n- detection:\n - name: detection_rule1\n type: THRESHOLD\n params:\n min: '0.70'\n", "componentSpecs":{ "detection_rule1:THRESHOLD":{ "min":"0.70", --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org