You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ak...@apache.org on 2019/03/13 22:39:41 UTC

[incubator-pinot] branch master updated: [TE] Yaml validator for maxDuration (#3967)

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 3656ed6  [TE] Yaml validator for maxDuration (#3967)
3656ed6 is described below

commit 3656ed661e209351b84201649aa698cd77a545f6
Author: Akshay Rai <ak...@gmail.com>
AuthorDate: Wed Mar 13 15:39:36 2019 -0700

    [TE] Yaml validator for maxDuration (#3967)
---
 .../detection/yaml/CompositePipelineConfigTranslator.java        | 9 +++++++++
 1 file changed, 9 insertions(+)

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 b84b7f6..13ffbdf 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
@@ -163,6 +163,7 @@ public class CompositePipelineConfigTranslator extends YamlDetectionConfigTransl
   private static final String DEFAULT_TIMEZONE = "America/Los_Angeles";
   private static final String DEFAULT_BASELINE_PROVIDER_YAML_TYPE = "RULE_BASELINE";
   private static final String PROP_BUCKET_PERIOD = "bucketPeriod";
+  private static final String PROP_MAX_DURATION = "maxDuration";
 
   private static final DetectionRegistry DETECTION_REGISTRY = DetectionRegistry.getInstance();
   static {
@@ -465,6 +466,14 @@ public class CompositePipelineConfigTranslator extends YamlDetectionConfigTransl
       Preconditions.checkArgument(MapUtils.getString(yamlConfig, PROP_METRIC).equals(MapUtils.getString(existingYamlConfig, PROP_METRIC)), "metric name cannot be modified");
       Preconditions.checkArgument(MapUtils.getString(yamlConfig, PROP_DATASET).equals(MapUtils.getString(existingYamlConfig, PROP_DATASET)), "dataset name cannot be modified");
     }
+
+    // Safety condition: Validate if maxDuration is greater than 15 minutes
+    Map<String, Object> mergerProperties = MapUtils.getMap(yamlConfig, PROP_MERGER, new HashMap());
+    if (mergerProperties.get(PROP_MAX_DURATION) != null) {
+      Preconditions.checkArgument(MapUtils.getLong(mergerProperties, PROP_MAX_DURATION) >= TimeUnit.MINUTES.toMillis(15),
+          "The maxDuration field set is not acceptable. Please check the the document  and set it correctly.");
+    }
+
     Set<String> names = new HashSet<>();
     List<Map<String, Object>> ruleYamls = getList(yamlConfig.get(PROP_RULES));
     for (int i = 0; i < ruleYamls.size(); i++) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org