Repository: tez Updated Branches: refs/heads/master 30eaa1e47 -> f27f4a13c
TEZ-3382. Tez analyzer: Should be resilient to new counters (rbalamohan) Project: http://git-wip-us.apache.org/repos/asf/tez/repo Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/f27f4a13 Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/f27f4a13 Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/f27f4a13 Branch: refs/heads/master Commit: f27f4a13cf175e80fce339d6091059cab53cb917 Parents: 30eaa1e Author: Rajesh Balamohan <[email protected]> Authored: Thu Jul 28 12:42:40 2016 +0530 Committer: Rajesh Balamohan <[email protected]> Committed: Thu Jul 28 12:42:40 2016 +0530 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../apache/tez/history/parser/utils/Utils.java | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tez/blob/f27f4a13/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 3d198fd..cdbd4c2 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -7,6 +7,7 @@ INCOMPATIBLE CHANGES ALL CHANGES: + TEZ-3382. Tez analyzer: Should be resilient to new counters. TEZ-3379. Tez analyzer: Move sysout to log4j. TEZ-3376. Fix groupId generation to account for dagId starting with 1. TEZ-3359. Add granular log levels for HistoryLoggingService. http://git-wip-us.apache.org/repos/asf/tez/blob/f27f4a13/tez-plugins/tez-history-parser/src/main/java/org/apache/tez/history/parser/utils/Utils.java ---------------------------------------------------------------------- diff --git a/tez-plugins/tez-history-parser/src/main/java/org/apache/tez/history/parser/utils/Utils.java b/tez-plugins/tez-history-parser/src/main/java/org/apache/tez/history/parser/utils/Utils.java index ffb854a..aacec8e 100644 --- a/tez-plugins/tez-history-parser/src/main/java/org/apache/tez/history/parser/utils/Utils.java +++ b/tez-plugins/tez-history-parser/src/main/java/org/apache/tez/history/parser/utils/Utils.java @@ -37,6 +37,7 @@ import org.apache.tez.history.parser.datamodel.TaskAttemptInfo.DataDependencyEve import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; +import org.slf4j.LoggerFactory; import java.util.List; @@ -44,6 +45,8 @@ import java.util.List; public class Utils { private static final String LOG4J_CONFIGURATION = "log4j.configuration"; + private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(Utils.class); + /** * Parse tez counters from json @@ -79,15 +82,22 @@ public class Utils { final String counterDisplayName = counterNode.optString(Constants.COUNTER_DISPLAY_NAME, counterName); final long counterValue = counterNode.getLong(Constants.COUNTER_VALUE); - TezCounter counter = group.findCounter( - counterName, - counterDisplayName); - counter.setValue(counterValue); + addCounter(group, counterName, counterDisplayName, counterValue); } } } return counters; } + + private static void addCounter(CounterGroup group, String counterName, String displayName, + long counterValue) { + try { + TezCounter counter = group.findCounter(counterName, displayName); + counter.setValue(counterValue); + } catch(IllegalArgumentException e) { + LOG.debug("Error finding {} in {} with displayName {}", counterName, group, displayName); + } + } public static List<DataDependencyEvent> parseDataEventDependencyFromJSON(JSONObject jsonObject) throws JSONException {
