You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by sa...@apache.org on 2019/12/19 22:23:25 UTC
[atlas] branch branch-2.0 updated: ATLAS-3565: Atlas server should
set startTime and endTime for hive_process to System.currentTimeMillis() if
either of these are null.
This is an automated email from the ASF dual-hosted git repository.
sarath pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 7132a7c ATLAS-3565: Atlas server should set startTime and endTime for hive_process to System.currentTimeMillis() if either of these are null.
7132a7c is described below
commit 7132a7c78c3f6a4199fb42ce00f42ca8b2b1db9f
Author: Saqeeb Shaikh <sa...@cloudera.com>
AuthorDate: Thu Dec 19 14:30:52 2019 +0530
ATLAS-3565: Atlas server should set startTime and endTime for hive_process to System.currentTimeMillis() if either of these are null.
Signed-off-by: Sarath Subramanian <sa...@apache.org>
(cherry picked from commit c789f2d7e5efa3d7c85829016541097319006651)
---
.../notification/preprocessor/EntityPreprocessor.java | 2 ++
.../notification/preprocessor/HivePreprocessor.java | 16 ++++++++++++++--
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/webapp/src/main/java/org/apache/atlas/notification/preprocessor/EntityPreprocessor.java b/webapp/src/main/java/org/apache/atlas/notification/preprocessor/EntityPreprocessor.java
index 0cddd41..89568e2 100644
--- a/webapp/src/main/java/org/apache/atlas/notification/preprocessor/EntityPreprocessor.java
+++ b/webapp/src/main/java/org/apache/atlas/notification/preprocessor/EntityPreprocessor.java
@@ -55,6 +55,8 @@ public abstract class EntityPreprocessor {
public static final String ATTRIBUTE_INDEXES = "indexes";
public static final String ATTRIBUTE_FOREIGN_KEYS = "foreign_keys";
public static final String ATTRIBUTE_INSTANCE = "instance";
+ public static final String ATTRIBUTE_START_TIME = "startTime";
+ public static final String ATTRIBUTE_END_TIME = "endTime";
public static final char QNAME_SEP_CLUSTER_NAME = '@';
public static final char QNAME_SEP_ENTITY_NAME = '.';
diff --git a/webapp/src/main/java/org/apache/atlas/notification/preprocessor/HivePreprocessor.java b/webapp/src/main/java/org/apache/atlas/notification/preprocessor/HivePreprocessor.java
index d31495c..cc5fe52 100644
--- a/webapp/src/main/java/org/apache/atlas/notification/preprocessor/HivePreprocessor.java
+++ b/webapp/src/main/java/org/apache/atlas/notification/preprocessor/HivePreprocessor.java
@@ -17,6 +17,7 @@
*/
package org.apache.atlas.notification.preprocessor;
+import com.google.common.base.Strings;
import org.apache.atlas.model.instance.AtlasEntity;
import org.apache.atlas.notification.preprocessor.PreprocessorContext.PreprocessAction;
import org.apache.commons.lang.StringUtils;
@@ -166,8 +167,19 @@ public class HivePreprocessor {
} else {
Object inputs = entity.getAttribute(ATTRIBUTE_INPUTS);
Object outputs = entity.getAttribute(ATTRIBUTE_OUTPUTS);
- int inputsCount = getCollectionSize(inputs);
- int outputsCount = getCollectionSize(outputs);
+ String startTime = String.valueOf(entity.getAttribute(ATTRIBUTE_START_TIME));
+ String endTime = String.valueOf(entity.getAttribute(ATTRIBUTE_END_TIME));
+
+ if (Strings.isNullOrEmpty(startTime) || "null".equals(startTime)) {
+ entity.setAttribute(ATTRIBUTE_START_TIME, System.currentTimeMillis());
+ }
+
+ if (Strings.isNullOrEmpty(endTime) || "null".equals(endTime)) {
+ entity.setAttribute(ATTRIBUTE_END_TIME, System.currentTimeMillis());
+ }
+
+ int inputsCount = getCollectionSize(inputs);
+ int outputsCount = getCollectionSize(outputs);
removeIgnoredObjectIds(inputs, context);
removeIgnoredObjectIds(outputs, context);