From f2c43aa872d688df3992c454a42e7d8adbfc8466 Mon Sep 17 00:00:00 2001 From: Christophe NOUCHET Date: Fri, 15 Feb 2019 06:53:06 +0100 Subject: [PATCH] Fix wrong metrics for Pig job using TEZ (#479) * Fix wrong metrics for Pig job using TEZ * Single return statement --- .../drelephant/tez/TezMetricsAggregator.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/app/com/linkedin/drelephant/tez/TezMetricsAggregator.java b/app/com/linkedin/drelephant/tez/TezMetricsAggregator.java index c04edd7fd..1330fab6c 100644 --- a/app/com/linkedin/drelephant/tez/TezMetricsAggregator.java +++ b/app/com/linkedin/drelephant/tez/TezMetricsAggregator.java @@ -85,11 +85,9 @@ public HadoopAggregatedData getResult() { private long getMapContainerSize(HadoopApplicationData data) { try { - long mapContainerSize = Long.parseLong(data.getConf().getProperty(TEZ_CONTAINER_CONFIG)); - if (mapContainerSize > 0) - return mapContainerSize; - else - return Long.parseLong(data.getConf().getProperty(MAP_CONTAINER_CONFIG)); + // Trying to get container size from tez config, if not found trying from MapReduce config + long mapContainerSize = data.getConf().containsKey(TEZ_CONTAINER_CONFIG) ? Long.parseLong(data.getConf().getProperty(TEZ_CONTAINER_CONFIG)) : -1; + return mapContainerSize > 0 ? mapContainerSize : Long.parseLong(data.getConf().getProperty(MAP_CONTAINER_CONFIG)); } catch ( NumberFormatException ex) { return CONTAINER_MEMORY_DEFAULT_BYTES; } @@ -97,11 +95,9 @@ private long getMapContainerSize(HadoopApplicationData data) { private long getReducerContainerSize(HadoopApplicationData data) { try { - long reducerContainerSize = Long.parseLong(data.getConf().getProperty(TEZ_CONTAINER_CONFIG)); - if (reducerContainerSize > 0) - return reducerContainerSize; - else - return Long.parseLong(data.getConf().getProperty(REDUCER_CONTAINER_CONFIG)); + // Trying to get container size from tez config, if not found trying from MapReduce config + long reducerContainerSize = data.getConf().containsKey(TEZ_CONTAINER_CONFIG) ? Long.parseLong(data.getConf().getProperty(TEZ_CONTAINER_CONFIG)) : -1; + return reducerContainerSize > 0 ? reducerContainerSize: Long.parseLong(data.getConf().getProperty(REDUCER_CONTAINER_CONFIG)); } catch ( NumberFormatException ex) { return CONTAINER_MEMORY_DEFAULT_BYTES; }