You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by hi...@apache.org on 2013/06/04 01:47:24 UTC

[1/2] TEZ-175. Cleanup logs.

Updated Branches:
  refs/heads/TEZ-1 9f040cf8b -> 9feab053f


http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-dag/src/main/java/org/apache/tez/dag/app/rm/node/AMNodeImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/rm/node/AMNodeImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/rm/node/AMNodeImpl.java
index 4c73559..a79358b 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/rm/node/AMNodeImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/rm/node/AMNodeImpl.java
@@ -55,12 +55,12 @@ public class AMNodeImpl implements AMNode {
   private int numSuccessfulTAs = 0;
   private boolean blacklistingEnabled;
   private boolean ignoreBlacklisting = false;
-  
+
   @SuppressWarnings("rawtypes")
   protected EventHandler eventHandler;
 
   private final List<ContainerId> containers = new LinkedList<ContainerId>();
-  
+
   //Book-keeping only. In case of Health status change.
   private final List<ContainerId> pastContainers = new LinkedList<ContainerId>();
 
@@ -69,8 +69,8 @@ public class AMNodeImpl implements AMNode {
   private final StateMachine<AMNodeState, AMNodeEventType, AMNodeEvent> stateMachine;
 
   private static StateMachineFactory
-  <AMNodeImpl, AMNodeState, AMNodeEventType, AMNodeEvent> 
-  stateMachineFactory = 
+  <AMNodeImpl, AMNodeState, AMNodeEventType, AMNodeEvent>
+  stateMachineFactory =
   new StateMachineFactory<AMNodeImpl, AMNodeState, AMNodeEventType, AMNodeEvent>(
   AMNodeState.ACTIVE)
         // Transitions from ACTIVE state.
@@ -97,7 +97,7 @@ public class AMNodeImpl implements AMNode {
     .addTransition(AMNodeState.FORCED_ACTIVE, AMNodeState.UNHEALTHY, AMNodeEventType.N_TURNED_UNHEALTHY, new NodeTurnedUnhealthyTransition())
     .addTransition(AMNodeState.FORCED_ACTIVE, EnumSet.of(AMNodeState.BLACKLISTED, AMNodeState.ACTIVE), AMNodeEventType.N_IGNORE_BLACKLISTING_DISABLED, new IgnoreBlacklistingDisabledTransition())
     .addTransition(AMNodeState.FORCED_ACTIVE, AMNodeState.FORCED_ACTIVE, EnumSet.of(AMNodeEventType.N_TURNED_HEALTHY, AMNodeEventType.N_IGNORE_BLACKLISTING_ENABLED), new GenericErrorTransition())
-            
+
         // Transitions from UNHEALTHY state.
     .addTransition(AMNodeState.UNHEALTHY, AMNodeState.UNHEALTHY, AMNodeEventType.N_CONTAINER_ALLOCATED, new ContainerAllocatedWhileUnhealthyTransition())
     .addTransition(AMNodeState.UNHEALTHY, AMNodeState.UNHEALTHY, EnumSet.of(AMNodeEventType.N_TA_SUCCEEDED, AMNodeEventType.N_TA_ENDED))
@@ -107,7 +107,7 @@ public class AMNodeImpl implements AMNode {
     .addTransition(AMNodeState.UNHEALTHY, AMNodeState.UNHEALTHY, AMNodeEventType.N_TURNED_UNHEALTHY, new GenericErrorTransition())
 
         .installTopology();
-  
+
 
   @SuppressWarnings("rawtypes")
   public AMNodeImpl(NodeId nodeId, int maxTaskFailuresPerNode,
@@ -153,10 +153,12 @@ public class AMNodeImpl implements AMNode {
 
   @Override
   public void handle(AMNodeEvent event) {
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Processing AMNodeEvent " + event.getNodeId()
+          + " of type " + event.getType() + " while in state: " + getState()
+          + ". Event: " + event);
+    }
     this.writeLock.lock();
-    LOG.info("DEBUG: Processing AMNodeEvent " + event.getNodeId()
-        + " of type " + event.getType() + " while in state: " + getState()
-        + ". Event: " + event);
     try {
       final AMNodeState oldState = getState();
       try {
@@ -174,7 +176,7 @@ public class AMNodeImpl implements AMNode {
       writeLock.unlock();
     }
   }
-  
+
   protected boolean shouldBlacklistNode() {
     return blacklistingEnabled && (numFailedTAs >= maxTaskFailuresPerNode);
   }
@@ -193,7 +195,7 @@ public class AMNodeImpl implements AMNode {
   //////////////////////////////////////////////////////////////////////////////
   //                   Start of Transition Classes                            //
   //////////////////////////////////////////////////////////////////////////////
-  
+
   protected static class ContainerAllocatedTransition implements
       SingleArcTransition<AMNodeImpl, AMNodeEvent> {
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-engine/src/main/java/org/apache/tez/engine/common/shuffle/impl/InMemoryWriter.java
----------------------------------------------------------------------
diff --git a/tez-engine/src/main/java/org/apache/tez/engine/common/shuffle/impl/InMemoryWriter.java b/tez-engine/src/main/java/org/apache/tez/engine/common/shuffle/impl/InMemoryWriter.java
index f683605..b3ebb8b 100644
--- a/tez-engine/src/main/java/org/apache/tez/engine/common/shuffle/impl/InMemoryWriter.java
+++ b/tez-engine/src/main/java/org/apache/tez/engine/common/shuffle/impl/InMemoryWriter.java
@@ -35,62 +35,64 @@ import org.apache.tez.engine.common.sort.impl.IFile.Writer;
 @InterfaceStability.Unstable
 public class InMemoryWriter extends Writer {
   private static final Log LOG = LogFactory.getLog(InMemoryWriter.class);
-  
+
   private DataOutputStream out;
-  
+
   public InMemoryWriter(BoundedByteArrayOutputStream arrayStream) {
     super(null);
-    this.out = 
+    this.out =
       new DataOutputStream(new IFileOutputStream(arrayStream));
   }
-  
+
   public void append(Object key, Object value) throws IOException {
     throw new UnsupportedOperationException
     ("InMemoryWriter.append(K key, V value");
   }
-  
+
   public void append(DataInputBuffer key, DataInputBuffer value)
   throws IOException {
     int keyLength = key.getLength() - key.getPosition();
     if (keyLength < 0) {
-      throw new IOException("Negative key-length not allowed: " + keyLength + 
+      throw new IOException("Negative key-length not allowed: " + keyLength +
                             " for " + key);
     }
-    
+
     boolean sameKey = (key == IFile.REPEAT_KEY);
-    
+
     int valueLength = value.getLength() - value.getPosition();
     if (valueLength < 0) {
-      throw new IOException("Negative value-length not allowed: " + 
+      throw new IOException("Negative value-length not allowed: " +
                             valueLength + " for " + value);
     }
-    
+
     if(sameKey) {
       WritableUtils.writeVInt(out, IFile.RLE_MARKER);
       WritableUtils.writeVInt(out, valueLength);
       out.write(value.getData(), value.getPosition(), valueLength);
     } else {
-      LOG.info("XXX InMemWriter.append" + 
-          " key.data=" + key.getData() + 
-          " key.pos=" + key.getPosition() + 
-          " key.len=" +key.getLength() + 
-          " val.data=" + value.getData() + 
-          " val.pos=" + value.getPosition() + 
-          " val.len=" + value.getLength());
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("InMemWriter.append" +
+            " key.data=" + key.getData() +
+            " key.pos=" + key.getPosition() +
+            " key.len=" +key.getLength() +
+            " val.data=" + value.getData() +
+            " val.pos=" + value.getPosition() +
+            " val.len=" + value.getLength());
+      }
       WritableUtils.writeVInt(out, keyLength);
       WritableUtils.writeVInt(out, valueLength);
-      out.write(key.getData(), key.getPosition(), keyLength); 
-      out.write(value.getData(), value.getPosition(), valueLength);      
+      out.write(key.getData(), key.getPosition(), keyLength);
+      out.write(value.getData(), value.getPosition(), valueLength);
     }
-     
+
   }
 
   public void close() throws IOException {
     // Write EOF_MARKER for key/value length
     WritableUtils.writeVInt(out, IFile.EOF_MARKER);
     WritableUtils.writeVInt(out, IFile.EOF_MARKER);
-    
-    // Close the stream 
+
+    // Close the stream
     out.close();
     out = null;
   }

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-engine/src/main/java/org/apache/tez/engine/common/sort/impl/ExternalSorter.java
----------------------------------------------------------------------
diff --git a/tez-engine/src/main/java/org/apache/tez/engine/common/sort/impl/ExternalSorter.java b/tez-engine/src/main/java/org/apache/tez/engine/common/sort/impl/ExternalSorter.java
index 76fc2e9..f5976e3 100644
--- a/tez-engine/src/main/java/org/apache/tez/engine/common/sort/impl/ExternalSorter.java
+++ b/tez-engine/src/main/java/org/apache/tez/engine/common/sort/impl/ExternalSorter.java
@@ -86,12 +86,12 @@ public abstract class ExternalSorter {
   protected SerializationFactory serializationFactory;
   protected Serializer keySerializer;
   protected Serializer valSerializer;
-  
+
   protected IndexedSorter sorter;
 
   // Compression for map-outputs
   protected CompressionCodec codec;
-  
+
   // Counters
   protected TezCounter mapOutputByteCounter;
   protected TezCounter mapOutputRecordCounter;
@@ -101,41 +101,41 @@ public abstract class ExternalSorter {
 
   public void initialize(Configuration conf, Master master)
       throws IOException, InterruptedException {
-    
+
     this.job = conf;
-    LOG.info("TEZ_ENGINE_TASK_ATTEMPT_ID: " + 
+    LOG.info("TEZ_ENGINE_TASK_ATTEMPT_ID: " +
         job.get(Constants.TEZ_ENGINE_TASK_ATTEMPT_ID));
 
     partitions = task.getOutputSpecList().get(0).getNumOutputs();
-//    partitions = 
+//    partitions =
 //        job.getInt(
-//            TezJobConfig.TEZ_ENGINE_TASK_OUTDEGREE, 
+//            TezJobConfig.TEZ_ENGINE_TASK_OUTDEGREE,
 //            TezJobConfig.DEFAULT_TEZ_ENGINE_TASK_OUTDEGREE);
     rfs = ((LocalFileSystem)FileSystem.getLocal(job)).getRaw();
-    
+
     // sorter
     sorter = ReflectionUtils.newInstance(job.getClass(
         TezJobConfig.TEZ_ENGINE_INTERNAL_SORTER_CLASS, QuickSort.class,
         IndexedSorter.class), job);
-    
+
     comparator = ConfigUtils.getIntermediateOutputKeyComparator(job);
-    
+
     // k/v serialization
     keyClass = ConfigUtils.getIntermediateOutputKeyClass(job);
     valClass = ConfigUtils.getIntermediateOutputValueClass(job);
     serializationFactory = new SerializationFactory(job);
     keySerializer = serializationFactory.getSerializer(keyClass);
     valSerializer = serializationFactory.getSerializer(valClass);
-    
+
     //    counters
-    mapOutputByteCounter = 
+    mapOutputByteCounter =
         runningTaskContext.getTaskReporter().getCounter(TaskCounter.MAP_OUTPUT_BYTES);
     mapOutputRecordCounter =
       runningTaskContext.getTaskReporter().getCounter(TaskCounter.MAP_OUTPUT_RECORDS);
-    fileOutputByteCounter = 
+    fileOutputByteCounter =
         runningTaskContext.getTaskReporter().
             getCounter(TaskCounter.MAP_OUTPUT_MATERIALIZED_BYTES);
-    spilledRecordsCounter = 
+    spilledRecordsCounter =
         runningTaskContext.getTaskReporter().getCounter(TaskCounter.SPILLED_RECORDS);
     // compression
     if (ConfigUtils.shouldCompressIntermediateOutput(job)) {
@@ -146,14 +146,13 @@ public abstract class ExternalSorter {
       codec = null;
     }
 
-    // Task outputs 
+    // Task outputs
     mapOutputFile =
         (TezTaskOutput) ReflectionUtils.newInstance(
             conf.getClass(
-                Constants.TEZ_ENGINE_TASK_OUTPUT_MANAGER, 
+                Constants.TEZ_ENGINE_TASK_OUTPUT_MANAGER,
                 TezTaskOutputFiles.class), conf);
-//    LOG.info("XXX mapOutputFile: " + mapOutputFile.getClass());
-    
+
     // sortPhase
     sortPhase  = runningTaskContext.getProgress().addPhase("sort", 0.333f);
   }
@@ -227,13 +226,8 @@ public abstract class ExternalSorter {
     if (!src.renameTo(dst)) {
       throw new IOException("Unable to rename " + src + " to " + dst);
     }
-//    LOG.info("XXX sameVolRename src=" + src + ", dst=" + dst);
   }
 
-//  public ExternalSorter() {
-//    super();
-//  }
-  
   public ExternalSorter(TezEngineTaskContext tezEngineTask) {
     this.task = tezEngineTask;
   }

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-engine/src/main/java/org/apache/tez/engine/common/sort/impl/IFileOutputStream.java
----------------------------------------------------------------------
diff --git a/tez-engine/src/main/java/org/apache/tez/engine/common/sort/impl/IFileOutputStream.java b/tez-engine/src/main/java/org/apache/tez/engine/common/sort/impl/IFileOutputStream.java
index 75fcd68..00b8958 100644
--- a/tez-engine/src/main/java/org/apache/tez/engine/common/sort/impl/IFileOutputStream.java
+++ b/tez-engine/src/main/java/org/apache/tez/engine/common/sort/impl/IFileOutputStream.java
@@ -36,11 +36,9 @@ import org.apache.hadoop.util.DataChecksum;
 @InterfaceAudience.Private
 @InterfaceStability.Unstable
 public class IFileOutputStream extends FilterOutputStream {
-  
-  private static final Log LOG = LogFactory.getLog(IFileOutputStream.class);
-  
+
   /**
-   * The output stream to be checksummed. 
+   * The output stream to be checksummed.
    */
   private final DataChecksum sum;
   private byte[] barray;
@@ -62,7 +60,7 @@ public class IFileOutputStream extends FilterOutputStream {
     buffer = new byte[4096];
     offset = 0;
   }
-  
+
   @Override
   public void close() throws IOException {
     if (closed) {
@@ -105,8 +103,8 @@ public class IFileOutputStream extends FilterOutputStream {
     // FIXME if needed re-enable this in debug mode
     if (LOG.isDebugEnabled()) {
       LOG.debug("XXX checksum" +
-          " b=" + b + " off=" + off + 
-          " buffer=" + " offset=" + offset + 
+          " b=" + b + " off=" + off +
+          " buffer=" + " offset=" + offset +
           " len=" + len);
     }
     */
@@ -123,7 +121,7 @@ public class IFileOutputStream extends FilterOutputStream {
     checksum(b, off, len);
     out.write(b,off,len);
   }
- 
+
   @Override
   public void write(int b) throws IOException {
     barray[0] = (byte) (b & 0xFF);

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-engine/src/main/java/org/apache/tez/engine/common/sort/impl/dflt/DefaultSorter.java
----------------------------------------------------------------------
diff --git a/tez-engine/src/main/java/org/apache/tez/engine/common/sort/impl/dflt/DefaultSorter.java b/tez-engine/src/main/java/org/apache/tez/engine/common/sort/impl/dflt/DefaultSorter.java
index e567492..adbff22 100644
--- a/tez-engine/src/main/java/org/apache/tez/engine/common/sort/impl/dflt/DefaultSorter.java
+++ b/tez-engine/src/main/java/org/apache/tez/engine/common/sort/impl/dflt/DefaultSorter.java
@@ -57,16 +57,16 @@ import org.apache.tez.engine.records.OutputContext;
 
 @SuppressWarnings({"unchecked", "rawtypes"})
 public class DefaultSorter extends ExternalSorter implements IndexedSortable {
-  
+
   private static final Log LOG = LogFactory.getLog(DefaultSorter.class);
-  
+
   /**
    * The size of each record in the index file for the map-outputs.
    */
   public static final int MAP_OUTPUT_INDEX_RECORD_LENGTH = 24;
 
   private final static int APPROX_HEADER_LENGTH = 150;
-  
+
   // k/v accounting
   IntBuffer kvmeta; // metadata overlay on backing store
   int kvstart;            // marks origin of spill metadata
@@ -118,15 +118,15 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
   }
 
   @Override
-  public void initialize(Configuration conf, Master master) 
+  public void initialize(Configuration conf, Master master)
       throws IOException, InterruptedException {
     if (task == null) {
       LOG.info("Bailing!", new IOException());
       return;
     }
-    
+
     super.initialize(conf, master);
-    
+
     // sanity checks
     final float spillper = job.getFloat(
         TezJobConfig.TEZ_ENGINE_SORT_SPILL_PERCENT,
@@ -144,7 +144,7 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
 
     indexCacheMemoryLimit = job.getInt(TezJobConfig.TEZ_ENGINE_INDEX_CACHE_MEMORY_LIMIT_BYTES,
                                        TezJobConfig.DEFAULT_TEZ_ENGINE_INDEX_CACHE_MEMORY_LIMIT_BYTES);
-    
+
     // buffers and accounting
     int maxMemUsage = sortmb << 20;
     maxMemUsage -= maxMemUsage % METASIZE;
@@ -169,8 +169,8 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
 
     // k/v serialization
     valSerializer.open(bb);
-    keySerializer.open(bb);   
-    
+    keySerializer.open(bb);
+
     spillInProgress = false;
     minSpillsForCombine = job.getInt(TezJobConfig.TEZ_ENGINE_COMBINE_MIN_SPILLS, 3);
     spillThread.setDaemon(true);
@@ -193,7 +193,7 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
   }
 
   @Override
-  public void write(Object key, Object value) 
+  public void write(Object key, Object value)
       throws IOException, InterruptedException {
     collect(
         key, value, partitioner.getPartition(key, value, partitions));
@@ -673,7 +673,7 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
             spillLock.unlock();
             sortAndSpill();
           } catch (Throwable t) {
-            LOG.warn("ZZZZ: Got an exception in sortAndSpill", t);
+            LOG.warn("Got an exception in sortAndSpill", t);
             sortSpillException = t;
           } finally {
             spillLock.lock();
@@ -727,23 +727,23 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
   int getMetaStart() {
     return kvend / NMETA;
   }
-  
+
   int getMetaEnd() {
     return 1 + // kvend is a valid record
         (kvstart >= kvend
         ? kvstart
         : kvmeta.capacity() + kvstart) / NMETA;
   }
-  
-  protected void sortAndSpill() 
+
+  protected void sortAndSpill()
       throws IOException, InterruptedException {
     final int mstart = getMetaStart();
     final int mend = getMetaEnd();
     sorter.sort(this, mstart, mend, runningTaskContext.getTaskReporter());
-    spill(mstart, mend); 
+    spill(mstart, mend);
   }
-  
-  protected void spill(int mstart, int mend) 
+
+  protected void spill(int mstart, int mend)
       throws IOException, InterruptedException {
 
     //approximate the length of the output file to be the length of the
@@ -775,7 +775,7 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
                 kvmeta.get(offsetFor(spindex) + PARTITION) == i) {
               final int kvoff = offsetFor(spindex);
               key.reset(
-                  kvbuffer, 
+                  kvbuffer,
                   kvmeta.get(kvoff + KEYSTART),
                   (kvmeta.get(kvoff + VALSTART) - kvmeta.get(kvoff + KEYSTART))
                   );
@@ -795,7 +795,9 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
             if (spstart != spindex) {
               TezRawKeyValueIterator kvIter =
                 new MRResultIterator(spstart, spindex);
-              LOG.info("DEBUG: Running combine processor");
+              if (LOG.isDebugEnabled()) {
+                LOG.debug("Running combine processor");
+              }
               runCombineProcessor(kvIter, writer);
             }
           }
@@ -804,10 +806,10 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
           writer.close();
 
           // record offsets
-          final TezIndexRecord rec = 
+          final TezIndexRecord rec =
               new TezIndexRecord(
-                  segmentStart, 
-                  writer.getRawLength(), 
+                  segmentStart,
+                  writer.getRawLength(),
                   writer.getCompressedLength());
           spillRec.putIndex(rec, i);
 
@@ -870,10 +872,10 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
           writer.close();
 
           // record offsets
-          TezIndexRecord rec = 
+          TezIndexRecord rec =
               new TezIndexRecord(
-                  segmentStart, 
-                  writer.getRawLength(), 
+                  segmentStart,
+                  writer.getRawLength(),
                   writer.getCompressedLength());
           spillRec.putIndex(rec, i);
 
@@ -913,7 +915,7 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
       : (bufvoid - kvmeta.get(kvoff + VALSTART)) + nextindex;
       return vallen;
   }
-  
+
   /**
    * Given an offset, populate vbytes with the associated set of
    * deserialized value bytes. Should only be called during a spill.
@@ -936,7 +938,7 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
     public InMemValBytes(int bufvoid) {
       this.bufvoid = bufvoid;
     }
-    
+
     public void reset(byte[] buffer, int start, int length) {
       this.buffer = buffer;
       this.start = start;
@@ -957,7 +959,7 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
   InMemValBytes createInMemValBytes() {
     return new InMemValBytes(bufvoid);
   }
-  
+
   protected class MRResultIterator implements TezRawKeyValueIterator {
     private final DataInputBuffer keybuf = new DataInputBuffer();
     private final InMemValBytes vbytes = createInMemValBytes();
@@ -1031,7 +1033,7 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
 
     if (numSpills == 0) {
       //create dummy files
-      
+
       TezSpillRecord sr = new TezSpillRecord(partitions);
       try {
         for (int i = 0; i < partitions; i++) {
@@ -1039,11 +1041,11 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
           Writer writer =
             new Writer(job, finalOut, keyClass, valClass, codec, null);
           writer.close();
-          
-          TezIndexRecord rec = 
+
+          TezIndexRecord rec =
               new TezIndexRecord(
-                  segmentStart, 
-                  writer.getRawLength(), 
+                  segmentStart,
+                  writer.getRawLength(),
                   writer.getCompressedLength());
           sr.putIndex(rec, i);
         }
@@ -1057,7 +1059,7 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
     else {
       sortPhase.addPhases(partitions); // Divide sort phase into sub-phases
       TezMerger.considerFinalMergeForProgress();
-      
+
       final TezSpillRecord spillRec = new TezSpillRecord(partitions);
       for (int parts = 0; parts < partitions; parts++) {
         //create the segments to be merged
@@ -1074,13 +1076,13 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
           if (LOG.isDebugEnabled()) {
             LOG.debug("MapId=" + mapId + " Reducer=" + parts +
                 "Spill =" + i + "(" + indexRecord.getStartOffset() + "," +
-                indexRecord.getRawLength() + ", " + 
+                indexRecord.getRawLength() + ", " +
                 indexRecord.getPartLength() + ")");
           }
         }
 
-        int mergeFactor = 
-            job.getInt(TezJobConfig.TEZ_ENGINE_IO_SORT_FACTOR, 
+        int mergeFactor =
+            job.getInt(TezJobConfig.TEZ_ENGINE_IO_SORT_FACTOR,
                 TezJobConfig.DEFAULT_TEZ_ENGINE_IO_SORT_FACTOR);
         // sort the segments only if there are intermediate merges
         boolean sortSegments = segmentList.size() > mergeFactor;
@@ -1089,9 +1091,9 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
                        keyClass, valClass, codec,
                        segmentList, mergeFactor,
                        new Path(mapId.toString()),
-                       (RawComparator)ConfigUtils.getIntermediateOutputKeyComparator(job), 
+                       (RawComparator)ConfigUtils.getIntermediateOutputKeyComparator(job),
                        runningTaskContext.getTaskReporter(), sortSegments,
-                       null, spilledRecordsCounter, 
+                       null, spilledRecordsCounter,
                        sortPhase.phase());
 
         //write merged output to disk
@@ -1109,10 +1111,10 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
 
         sortPhase.startNextPhase();
         // record offsets
-        final TezIndexRecord rec = 
+        final TezIndexRecord rec =
             new TezIndexRecord(
-                segmentStart, 
-                writer.getRawLength(), 
+                segmentStart,
+                writer.getRawLength(),
                 writer.getCompressedLength());
         spillRec.putIndex(rec, parts);
       }
@@ -1123,7 +1125,7 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
       }
     }
   }
-  
+
   @Override
   public OutputContext getOutputContext() {
     return null;

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-engine/src/main/java/org/apache/tez/engine/common/task/local/output/TezTaskOutputFiles.java
----------------------------------------------------------------------
diff --git a/tez-engine/src/main/java/org/apache/tez/engine/common/task/local/output/TezTaskOutputFiles.java b/tez-engine/src/main/java/org/apache/tez/engine/common/task/local/output/TezTaskOutputFiles.java
index 5fb6519..b7874f0 100644
--- a/tez-engine/src/main/java/org/apache/tez/engine/common/task/local/output/TezTaskOutputFiles.java
+++ b/tez-engine/src/main/java/org/apache/tez/engine/common/task/local/output/TezTaskOutputFiles.java
@@ -55,20 +55,22 @@ public class TezTaskOutputFiles extends TezTaskOutput {
   }
 
   // assume configured to $localdir/usercache/$user/appcache/$appId
-  private LocalDirAllocator lDirAlloc = 
+  private LocalDirAllocator lDirAlloc =
     new LocalDirAllocator(TezJobConfig.LOCAL_DIRS);
 
   private Path getAttemptOutputDir() {
-    LOG.info("DEBUG: getAttemptOutputDir: "
-        + Constants.TASK_OUTPUT_DIR + "/"
-        + conf.get(Constants.TEZ_ENGINE_TASK_ATTEMPT_ID));
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("getAttemptOutputDir: "
+          + Constants.TASK_OUTPUT_DIR + "/"
+          + conf.get(Constants.TEZ_ENGINE_TASK_ATTEMPT_ID));
+    }
     return new Path(Constants.TASK_OUTPUT_DIR,
         conf.get(Constants.TEZ_ENGINE_TASK_ATTEMPT_ID));
   }
-  
+
   /**
    * Return the path to local map output file created earlier
-   * 
+   *
    * @return path
    * @throws IOException
    */
@@ -80,13 +82,13 @@ public class TezTaskOutputFiles extends TezTaskOutput {
 
   /**
    * Create a local map output file name.
-   * 
+   *
    * @param size the size of the file
    * @return path
    * @throws IOException
    */
   public Path getOutputFileForWrite(long size) throws IOException {
-    Path attemptOutput = 
+    Path attemptOutput =
       new Path(getAttemptOutputDir(), Constants.TEZ_ENGINE_TASK_OUTPUT_FILENAME_STRING);
     return lDirAlloc.getLocalPathForWrite(attemptOutput.toString(), size, conf);
   }
@@ -103,7 +105,7 @@ public class TezTaskOutputFiles extends TezTaskOutput {
 
   /**
    * Return the path to a local map output index file created earlier
-   * 
+   *
    * @return path
    * @throws IOException
    */
@@ -116,7 +118,7 @@ public class TezTaskOutputFiles extends TezTaskOutput {
 
   /**
    * Create a local map output index file name.
-   * 
+   *
    * @param size the size of the file
    * @return path
    * @throws IOException
@@ -142,7 +144,7 @@ public class TezTaskOutputFiles extends TezTaskOutput {
 
   /**
    * Return a local map spill file created earlier.
-   * 
+   *
    * @param spillNumber the number
    * @return path
    * @throws IOException
@@ -155,7 +157,7 @@ public class TezTaskOutputFiles extends TezTaskOutput {
 
   /**
    * Create a local map spill file name.
-   * 
+   *
    * @param spillNumber the number
    * @param size the size of the file
    * @return path
@@ -170,7 +172,7 @@ public class TezTaskOutputFiles extends TezTaskOutput {
 
   /**
    * Return a local map spill index file created earlier
-   * 
+   *
    * @param spillNumber the number
    * @return path
    * @throws IOException
@@ -183,7 +185,7 @@ public class TezTaskOutputFiles extends TezTaskOutput {
 
   /**
    * Create a local map spill index file name.
-   * 
+   *
    * @param spillNumber the number
    * @param size the size of the file
    * @return path
@@ -198,10 +200,10 @@ public class TezTaskOutputFiles extends TezTaskOutput {
 
   /**
    * Return a local reduce input file created earlier
-   * 
+   *
    * @param mapId a map task id
    * @return path
-   * @throws IOException 
+   * @throws IOException
    */
   public Path getInputFile(int mapId) throws IOException {
     throw new UnsupportedOperationException("Incompatible with LocalRunner");
@@ -209,7 +211,7 @@ public class TezTaskOutputFiles extends TezTaskOutput {
 
   /**
    * Create a local reduce input file name.
-   * 
+   *
    * @param mapId a map task id
    * @param size the size of the file
    * @return path
@@ -235,5 +237,5 @@ public class TezTaskOutputFiles extends TezTaskOutput {
   public Configuration getConf() {
     return conf;
   }
-  
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-engine/src/main/java/org/apache/tez/engine/lib/output/LocalOnFileSorterOutput.java
----------------------------------------------------------------------
diff --git a/tez-engine/src/main/java/org/apache/tez/engine/lib/output/LocalOnFileSorterOutput.java b/tez-engine/src/main/java/org/apache/tez/engine/lib/output/LocalOnFileSorterOutput.java
index 1d2360b..a954f6e 100644
--- a/tez-engine/src/main/java/org/apache/tez/engine/lib/output/LocalOnFileSorterOutput.java
+++ b/tez-engine/src/main/java/org/apache/tez/engine/lib/output/LocalOnFileSorterOutput.java
@@ -30,28 +30,28 @@ import org.apache.tez.engine.common.task.local.output.TezTaskOutput;
 public class LocalOnFileSorterOutput extends OnFileSortedOutput {
 
   private static final Log LOG = LogFactory.getLog(LocalOnFileSorterOutput.class);
-  
+
   public LocalOnFileSorterOutput(TezEngineTaskContext task) throws IOException {
     super(task);
   }
 
   @Override
   public void close() throws IOException, InterruptedException {
-    LOG.info("XXX close");
-
+    LOG.debug("Closing LocalOnFileSorterOutput");
     super.close();
 
-
     TezTaskOutput mapOutputFile = sorter.getMapOutput();
     FileSystem localFs = FileSystem.getLocal(mapOutputFile.getConf());
 
     Path src = mapOutputFile.getOutputFile();
-    Path dst = 
+    Path dst =
         mapOutputFile.getInputFileForWrite(
             sorter.getTaskAttemptId().getTaskID(),
             localFs.getFileStatus(src).getLen());
 
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Renaming src = " + src + ", dst = " + dst);
+    }
     localFs.rename(src, dst);
-    LOG.info("XXX renaming src = " + src + ", dst = " + dst);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-engine/src/main/java/org/apache/tez/engine/runtime/RuntimeUtils.java
----------------------------------------------------------------------
diff --git a/tez-engine/src/main/java/org/apache/tez/engine/runtime/RuntimeUtils.java b/tez-engine/src/main/java/org/apache/tez/engine/runtime/RuntimeUtils.java
index 900c2f0..1946a62 100644
--- a/tez-engine/src/main/java/org/apache/tez/engine/runtime/RuntimeUtils.java
+++ b/tez-engine/src/main/java/org/apache/tez/engine/runtime/RuntimeUtils.java
@@ -62,7 +62,7 @@ public class RuntimeUtils {
 
   public static RuntimeTask createRuntimeTask(
       TezEngineTaskContext taskContext) {
-    LOG.info("TaskContext"
+    LOG.info("Creating a runtime task from TaskContext"
         + ", Processor: " + taskContext.getProcessorName()
         + ", InputCount=" + taskContext.getInputSpecList().size()
         + ", OutputCount=" + taskContext.getOutputSpecList().size());
@@ -78,38 +78,45 @@ public class RuntimeUtils {
       Input[] inputs;
       Output[] outputs;
       if (taskContext.getInputSpecList().isEmpty()) {
-        LOG.info("Initializing task with 0 inputs");
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("Initializing task with 0 inputs");
+        }
         inputs = new Input[0];
       } else {
         int iSpecCount = taskContext.getInputSpecList().size();
         inputs = new Input[iSpecCount];
         for (int i = 0; i < iSpecCount; ++i) {
           InputSpec inSpec = taskContext.getInputSpecList().get(i);
-          LOG.info("XXXX Using Input"
-              + ", index=" + i
-              + ", inputClass=" + inSpec.getInputClassName());
+          if (LOG.isDebugEnabled()) {
+            LOG.debug("Using Input"
+                + ", index=" + i
+                + ", inputClass=" + inSpec.getInputClassName());
+          }
           Class<?> inputClazz = Class.forName(inSpec.getInputClassName());
           Input input = (Input) getNewInstance(inputClazz, taskContext);
           inputs[i] = input;
         }
       }
       if (taskContext.getOutputSpecList().isEmpty()) {
-        LOG.info("Initializing task with 0 outputs");
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("Initializing task with 0 outputs");
+        }
         outputs = new Output[0];
       } else {
         int oSpecCount = taskContext.getOutputSpecList().size();
         outputs = new Output[oSpecCount];
         for (int i = 0; i < oSpecCount; ++i) {
           OutputSpec outSpec = taskContext.getOutputSpecList().get(i);
-          LOG.info("XXXX Using Output"
-              + ", index=" + i
-              + ", output=" + outSpec.getOutputClassName());
+          if (LOG.isDebugEnabled()) {
+            LOG.debug("Using Output"
+                + ", index=" + i
+                + ", output=" + outSpec.getOutputClassName());
+          }
           Class<?> outputClazz = Class.forName(outSpec.getOutputClassName());
           Output output = (Output) getNewInstance(outputClazz, taskContext);
           outputs[i] = output;
         }
       }
-      // t = new RuntimeTask(taskContext, processor, inputs, outputs);
       t = createRuntime(taskContext, processor, inputs, outputs);
     } catch (ClassNotFoundException e) {
       throw new YarnException("Unable to initialize RuntimeTask, context="
@@ -117,7 +124,7 @@ public class RuntimeUtils {
     }
     return t;
   }
-  
+
   private static RuntimeTask createRuntime(TezEngineTaskContext taskContext,
       Processor processor, Input[] inputs, Output[] outputs) {
     try {

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-mapreduce/src/main/java/org/apache/hadoop/mapred/LocalJobRunner.java
----------------------------------------------------------------------
diff --git a/tez-mapreduce/src/main/java/org/apache/hadoop/mapred/LocalJobRunner.java b/tez-mapreduce/src/main/java/org/apache/hadoop/mapred/LocalJobRunner.java
index 5dade2b..e930044 100644
--- a/tez-mapreduce/src/main/java/org/apache/hadoop/mapred/LocalJobRunner.java
+++ b/tez-mapreduce/src/main/java/org/apache/hadoop/mapred/LocalJobRunner.java
@@ -106,7 +106,7 @@ public class LocalJobRunner implements ClientProtocol {
   private AtomicInteger map_tasks = new AtomicInteger(0);
   private int reduce_tasks = 0;
   final Random rand = new Random();
-  
+
   private LocalJobRunnerMetrics myMetrics = null;
 
   private static final String jobDir =  "localRunner/";
@@ -129,7 +129,7 @@ public class LocalJobRunner implements ClientProtocol {
     // This is analogous to JobTracker's system directory.
     private Path systemJobDir;
     private Path systemJobFile;
-    
+
     // The job directory for the task.  Analagous to a task's job directory.
     private Path localJobDir;
     private Path localJobFile;
@@ -149,13 +149,13 @@ public class LocalJobRunner implements ClientProtocol {
     private JobProfile profile;
     private FileSystem localFs;
     boolean killed = false;
-    
+
     private LocalDistributedCacheManager localDistributedCacheManager;
 
     public long getProtocolVersion(String protocol, long clientVersion) {
       return TaskUmbilicalProtocol.versionID;
     }
-    
+
     @Override
     public ProtocolSignature getProtocolSignature(String protocol,
         long clientVersion, int clientMethodsHash) throws IOException {
@@ -176,7 +176,7 @@ public class LocalJobRunner implements ClientProtocol {
       // this will trigger localFile to be re-written again.
       localDistributedCacheManager = new LocalDistributedCacheManager();
       localDistributedCacheManager.setup(conf);
-      
+
       // Write out configuration file.  Instead of copying it from
       // systemJobFile, we re-write it, since setup(), above, may have
       // updated it.
@@ -193,11 +193,11 @@ public class LocalJobRunner implements ClientProtocol {
         setContextClassLoader(localDistributedCacheManager.makeClassLoader(
                 getContextClassLoader()));
       }
-      
-      profile = new JobProfile(job.getUser(), id, systemJobFile.toString(), 
+
+      profile = new JobProfile(job.getUser(), id, systemJobFile.toString(),
                                "http://localhost:8080/", job.getJobName());
-      status = new JobStatus(id, 0.0f, 0.0f, JobStatus.RUNNING, 
-          profile.getUser(), profile.getJobName(), profile.getJobFile(), 
+      status = new JobStatus(id, 0.0f, 0.0f, JobStatus.RUNNING,
+          profile.getUser(), profile.getJobName(), profile.getJobFile(),
           profile.getURL().toString());
 
       jobs.put(id, this);
@@ -235,7 +235,7 @@ public class LocalJobRunner implements ClientProtocol {
           TaskAttemptID mapId = new TaskAttemptID(new TaskID(
               jobId, TaskType.MAP, taskId), 0);
           LOG.info("Starting task: " + mapId);
-          final String user = 
+          final String user =
               UserGroupInformation.getCurrentUser().getShortUserName();
           setupChildMapredLocalDirs(mapId, user, localConf);
           localConf.setUser(user);
@@ -244,7 +244,7 @@ public class LocalJobRunner implements ClientProtocol {
               IDConverter.fromMRTaskAttemptId(mapId);
           mapIds.add(mapId);
           // FIXME invalid task context
-          TezEngineTaskContext taskContext = 
+          TezEngineTaskContext taskContext =
               new TezEngineTaskContext(
                   tezMapId, user, localConf.getJobName(), "TODO_vertexName",
                   MapProcessor.class.getName(),
@@ -346,7 +346,7 @@ public class LocalJobRunner implements ClientProtocol {
       return executor;
     }
 
-    private org.apache.hadoop.mapreduce.OutputCommitter 
+    private org.apache.hadoop.mapreduce.OutputCommitter
     createOutputCommitter(boolean newApiCommitter, JobID jobId, Configuration conf) throws Exception {
       org.apache.hadoop.mapreduce.OutputCommitter committer = null;
 
@@ -358,7 +358,7 @@ public class LocalJobRunner implements ClientProtocol {
             new org.apache.hadoop.mapreduce.TaskID(jobId, TaskType.MAP, 0);
         org.apache.hadoop.mapreduce.TaskAttemptID taskAttemptID =
             new org.apache.hadoop.mapreduce.TaskAttemptID(taskId, 0);
-        org.apache.hadoop.mapreduce.TaskAttemptContext taskContext = 
+        org.apache.hadoop.mapreduce.TaskAttemptContext taskContext =
             new TaskAttemptContextImpl(conf, taskAttemptID);
         @SuppressWarnings("rawtypes")
         OutputFormat outputFormat =
@@ -377,7 +377,7 @@ public class LocalJobRunner implements ClientProtocol {
     public void run() {
       JobID jobId = profile.getJobID();
       JobContext jContext = new JobContextImpl(job, jobId);
-      
+
       org.apache.hadoop.mapreduce.OutputCommitter outputCommitter = null;
       try {
         outputCommitter = createOutputCommitter(conf.getUseNewMapper(), jobId, conf);
@@ -385,9 +385,9 @@ public class LocalJobRunner implements ClientProtocol {
         LOG.info("Failed to createOutputCommitter", e);
         return;
       }
-      
+
       try {
-        TaskSplitMetaInfo[] taskSplitMetaInfos = 
+        TaskSplitMetaInfo[] taskSplitMetaInfos =
           SplitMetaInfoReader.readSplitMetaInfo(jobId, localFs, conf, systemJobDir);
 
         int numReduceTasks = job.getNumReduceTasks();
@@ -440,7 +440,7 @@ public class LocalJobRunner implements ClientProtocol {
         LOG.info("Starting task: " + reduceId);
         try {
           if (numReduceTasks > 0) {
-            String user = 
+            String user =
                 UserGroupInformation.getCurrentUser().getShortUserName();
             JobConf localConf = new JobConf(job);
             localConf.setUser(user);
@@ -457,14 +457,16 @@ public class LocalJobRunner implements ClientProtocol {
                 Collections.singletonList(new OutputSpec("TODO_targetVertex",
                     0, SimpleOutput.class.getName())));
 
-            // move map output to reduce input  
+            // move map output to reduce input
             for (int i = 0; i < mapIds.size(); i++) {
               if (!this.isInterrupted()) {
                 TaskAttemptID mapId = mapIds.get(i);
-                LOG.info("XXX mapId: " + i + 
-                    " LOCAL_DIR = " + 
-                    mapOutputFiles.get(mapId).getConf().get(
-                        TezJobConfig.LOCAL_DIRS));
+                if (LOG.isDebugEnabled()) {
+                  LOG.debug("XXX mapId: " + i +
+                      " LOCAL_DIR = " +
+                      mapOutputFiles.get(mapId).getConf().get(
+                          TezJobConfig.LOCAL_DIRS));
+                }
                 Path mapOut = mapOutputFiles.get(mapId).getOutputFile();
                 TezTaskOutput localOutputFile = new TezLocalTaskOutputFiles();
                 localOutputFile.setConf(localConf);
@@ -514,7 +516,7 @@ public class LocalJobRunner implements ClientProtocol {
 
       } catch (Throwable t) {
         try {
-          outputCommitter.abortJob(jContext, 
+          outputCommitter.abortJob(jContext,
             org.apache.hadoop.mapreduce.JobStatus.State.FAILED);
         } catch (IOException ioe) {
           LOG.info("Error cleaning up job:" + id);
@@ -547,7 +549,7 @@ public class LocalJobRunner implements ClientProtocol {
         throws IOException {
       return null;
     }
-    
+
     @Override
     public synchronized boolean statusUpdate(TezTaskAttemptID taskId,
         TezTaskStatus taskStatus) throws IOException, InterruptedException {
@@ -596,7 +598,7 @@ public class LocalJobRunner implements ClientProtocol {
      */
     @Override
     public void commitPending(TezTaskAttemptID taskid,
-                              TezTaskStatus taskStatus) 
+                              TezTaskStatus taskStatus)
     throws IOException, InterruptedException {
       statusUpdate(taskid, taskStatus);
     }
@@ -605,17 +607,17 @@ public class LocalJobRunner implements ClientProtocol {
     public void reportDiagnosticInfo(TezTaskAttemptID taskid, String trace) {
       // Ignore for now
     }
-    
+
     @Override
     public boolean ping(TezTaskAttemptID taskid) throws IOException {
       return true;
     }
-    
+
     @Override
     public boolean canCommit(TezTaskAttemptID taskid) throws IOException {
       return true;
     }
-    
+
     @Override
     public void done(TezTaskAttemptID taskId) throws IOException {
       int taskIndex = mapIds.indexOf(taskId);
@@ -627,25 +629,25 @@ public class LocalJobRunner implements ClientProtocol {
     }
 
     @Override
-    public synchronized void fsError(TezTaskAttemptID taskId, String message) 
+    public synchronized void fsError(TezTaskAttemptID taskId, String message)
     throws IOException {
       LOG.fatal("FSError: "+ message + "from task: " + taskId);
     }
 
     @Override
-    public void shuffleError(TezTaskAttemptID taskId, String message) 
+    public void shuffleError(TezTaskAttemptID taskId, String message)
         throws IOException {
       LOG.fatal("shuffleError: "+ message + "from task: " + taskId);
     }
-    
+
     @Override
-    public synchronized void fatalError(TezTaskAttemptID taskId, String msg) 
+    public synchronized void fatalError(TezTaskAttemptID taskId, String msg)
     throws IOException {
       LOG.fatal("Fatal: "+ msg + "from task: " + taskId);
     }
-    
+
     @Override
-    public TezTaskDependencyCompletionEventsUpdate 
+    public TezTaskDependencyCompletionEventsUpdate
     getDependentTasksCompletionEvents(
         int fromEventIdx, int maxEventsToFetch,
         TezTaskAttemptID reduce) {
@@ -704,7 +706,7 @@ public class LocalJobRunner implements ClientProtocol {
     throw new UnsupportedOperationException("Changing job priority " +
                       "in LocalJobRunner is not supported.");
   }
-  
+
   /** Throws {@link UnsupportedOperationException} */
   public boolean killTask(org.apache.hadoop.mapreduce.TaskAttemptID taskId,
       boolean shouldFail) throws IOException {
@@ -722,10 +724,10 @@ public class LocalJobRunner implements ClientProtocol {
     Job job = jobs.get(JobID.downgrade(id));
     if(job != null)
       return job.status;
-    else 
+    else
       return null;
   }
-  
+
   public org.apache.hadoop.mapreduce.Counters getJobCounters(
       org.apache.hadoop.mapreduce.JobID id) {
     Job job = jobs.get(JobID.downgrade(id));
@@ -737,7 +739,7 @@ public class LocalJobRunner implements ClientProtocol {
   public String getFilesystemName() throws IOException {
     return fs.getUri().toString();
   }
-  
+
   public ClusterMetrics getClusterMetrics() {
     int numMapTasks = map_tasks.get();
     return new ClusterMetrics(numMapTasks, reduce_tasks, numMapTasks,
@@ -748,25 +750,25 @@ public class LocalJobRunner implements ClientProtocol {
     return JobTrackerStatus.RUNNING;
   }
 
-  public long getTaskTrackerExpiryInterval() 
+  public long getTaskTrackerExpiryInterval()
       throws IOException, InterruptedException {
     return 0;
   }
 
-  /** 
-   * Get all active trackers in cluster. 
+  /**
+   * Get all active trackers in cluster.
    * @return array of TaskTrackerInfo
    */
-  public TaskTrackerInfo[] getActiveTrackers() 
+  public TaskTrackerInfo[] getActiveTrackers()
       throws IOException, InterruptedException {
     return null;
   }
 
-  /** 
-   * Get all blacklisted trackers in cluster. 
+  /**
+   * Get all blacklisted trackers in cluster.
    * @return array of TaskTrackerInfo
    */
-  public TaskTrackerInfo[] getBlacklistedTrackers() 
+  public TaskTrackerInfo[] getBlacklistedTrackers()
       throws IOException, InterruptedException {
     return null;
   }
@@ -776,10 +778,10 @@ public class LocalJobRunner implements ClientProtocol {
       , int fromEventId, int maxEvents) throws IOException {
     return TaskCompletionEvent.EMPTY_ARRAY;
   }
-  
+
   public org.apache.hadoop.mapreduce.JobStatus[] getAllJobs() {return null;}
 
-  
+
   /**
    * Returns the diagnostic information for a particular task in the given job.
    * To be implemented
@@ -794,7 +796,7 @@ public class LocalJobRunner implements ClientProtocol {
    */
   public String getSystemDir() {
     Path sysDir = new Path(
-      conf.get(JTConfig.JT_SYSTEM_DIR, "/tmp/hadoop/mapred/system"));  
+      conf.get(JTConfig.JT_SYSTEM_DIR, "/tmp/hadoop/mapred/system"));
     return fs.makeQualified(sysDir).toString();
   }
 
@@ -809,7 +811,7 @@ public class LocalJobRunner implements ClientProtocol {
    * @see org.apache.hadoop.mapreduce.protocol.ClientProtocol#getStagingAreaDir()
    */
   public String getStagingAreaDir() throws IOException {
-    Path stagingRootDir = new Path(conf.get(JTConfig.JT_STAGING_AREA_ROOT, 
+    Path stagingRootDir = new Path(conf.get(JTConfig.JT_STAGING_AREA_ROOT,
         "/tmp/hadoop/mapred/staging"));
     UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
     String user;
@@ -820,7 +822,7 @@ public class LocalJobRunner implements ClientProtocol {
     }
     return fs.makeQualified(new Path(stagingRootDir, user+"/.staging")).toString();
   }
-  
+
   public String getJobHistoryDir() {
     return null;
   }
@@ -847,7 +849,7 @@ public class LocalJobRunner implements ClientProtocol {
   }
 
   @Override
-  public org.apache.hadoop.mapreduce.QueueAclsInfo[] 
+  public org.apache.hadoop.mapreduce.QueueAclsInfo[]
       getQueueAclsForCurrentUser() throws IOException{
     return null;
   }
@@ -879,7 +881,7 @@ public class LocalJobRunner implements ClientProtocol {
   }
 
   @Override
-  public Token<DelegationTokenIdentifier> 
+  public Token<DelegationTokenIdentifier>
      getDelegationToken(Text renewer) throws IOException, InterruptedException {
     return null;
   }
@@ -896,10 +898,10 @@ public class LocalJobRunner implements ClientProtocol {
       throws IOException, InterruptedException {
     throw new UnsupportedOperationException("Not supported");
   }
-  
+
   static void setupChildMapredLocalDirs(
       TaskAttemptID taskAttemptID, String user, JobConf conf) {
-    String[] localDirs = 
+    String[] localDirs =
         conf.getTrimmedStrings(
             TezJobConfig.LOCAL_DIRS, TezJobConfig.DEFAULT_LOCAL_DIRS);
     String jobId = taskAttemptID.getJobID().toString();
@@ -912,17 +914,17 @@ public class LocalJobRunner implements ClientProtocol {
       childMapredLocalDir.append("," + localDirs[i] + Path.SEPARATOR
           + getLocalTaskDir(user, jobId, taskId, isCleanup));
     }
-    LOG.info(TezJobConfig.LOCAL_DIRS + " for child : " + taskAttemptID + 
+    LOG.info(TezJobConfig.LOCAL_DIRS + " for child : " + taskAttemptID +
         " is " + childMapredLocalDir);
     conf.set(TezJobConfig.LOCAL_DIRS, childMapredLocalDir.toString());
-    conf.setClass(Constants.TEZ_ENGINE_TASK_OUTPUT_MANAGER, 
+    conf.setClass(Constants.TEZ_ENGINE_TASK_OUTPUT_MANAGER,
         TezLocalTaskOutputFiles.class, TezTaskOutput.class);
   }
-  
+
   static final String TASK_CLEANUP_SUFFIX = ".cleanup";
   static final String SUBDIR = jobDir;
   static final String JOBCACHE = "jobcache";
-  
+
   static String getLocalTaskDir(String user, String jobid, String taskid,
       boolean isCleanupAttempt) {
     String taskDir = SUBDIR + Path.SEPARATOR + user + Path.SEPARATOR + JOBCACHE
@@ -932,6 +934,6 @@ public class LocalJobRunner implements ClientProtocol {
     }
     return taskDir;
   }
-  
-  
+
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-mapreduce/src/main/java/org/apache/hadoop/mapreduce/split/SplitMetaInfoReaderTez.java
----------------------------------------------------------------------
diff --git a/tez-mapreduce/src/main/java/org/apache/hadoop/mapreduce/split/SplitMetaInfoReaderTez.java b/tez-mapreduce/src/main/java/org/apache/hadoop/mapreduce/split/SplitMetaInfoReaderTez.java
index 72246c0..0fcfe65 100644
--- a/tez-mapreduce/src/main/java/org/apache/hadoop/mapreduce/split/SplitMetaInfoReaderTez.java
+++ b/tez-mapreduce/src/main/java/org/apache/hadoop/mapreduce/split/SplitMetaInfoReaderTez.java
@@ -61,12 +61,14 @@ public class SplitMetaInfoReaderTez {
         conf.get(TezJobConfig.TASK_LOCAL_RESOURCE_DIR),
         MRJobConfig.JOB_SPLIT_METAINFO);
     String jobSplitFile = MRJobConfig.JOB_SPLIT;
-    
+
     File file = new File(metaSplitFile.toUri().getPath()).getAbsoluteFile();
-    LOG.info("DEBUG: Setting up JobSplitIndex with JobSplitFile at: "
-        + file.getAbsolutePath() + ", defaultFS from conf: "
-        + FileSystem.getDefaultUri(conf));
-    
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Setting up JobSplitIndex with JobSplitFile at: "
+          + file.getAbsolutePath() + ", defaultFS from conf: "
+          + FileSystem.getDefaultUri(conf));
+    }
+
     FileStatus fStatus = fs.getFileStatus(metaSplitFile);
     if (maxMetaInfoSize > 0 && fStatus.getLen() > maxMetaInfoSize) {
       throw new IOException("Split metadata size exceeded " + maxMetaInfoSize

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/combine/MRCombiner.java
----------------------------------------------------------------------
diff --git a/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/combine/MRCombiner.java b/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/combine/MRCombiner.java
index b8a99ee..a3880f4 100644
--- a/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/combine/MRCombiner.java
+++ b/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/combine/MRCombiner.java
@@ -83,8 +83,9 @@ public class MRCombiner implements Processor {
   @Override
   public void process(Input[] in, Output[] out) throws IOException,
       InterruptedException {
-    LOG.info("DEBUG: Running MRCombiner"
-        + ", usingNewAPI=" + useNewApi);
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Running MRCombiner, usingNewAPI=" + useNewApi);
+    }
 
     CombineInput input = (CombineInput)in[0];
     CombineOutput output = (CombineOutput)out[0];
@@ -334,8 +335,6 @@ public class MRCombiner implements Processor {
           comparator,
           keyClass,
           valueClass);
-    LOG.info("DEBUG: Using combineKeyClass: "
-          + keyClass + ", combineValueClass: " + valueClass);
 
     org.apache.hadoop.mapreduce.Reducer<INKEY,INVALUE,OUTKEY,OUTVALUE>.Context
         reducerContext = new

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/hadoop/MultiStageMRConfToTezTranslator.java
----------------------------------------------------------------------
diff --git a/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/hadoop/MultiStageMRConfToTezTranslator.java b/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/hadoop/MultiStageMRConfToTezTranslator.java
index 9f1ae88..54648f5 100644
--- a/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/hadoop/MultiStageMRConfToTezTranslator.java
+++ b/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/hadoop/MultiStageMRConfToTezTranslator.java
@@ -31,7 +31,7 @@ import org.apache.tez.mapreduce.hadoop.DeprecatedKeys.MultiStageKeys;
 public class MultiStageMRConfToTezTranslator {
 
   private static final Log LOG = LogFactory.getLog(MultiStageMRConfToTezTranslator.class);
-  
+
   private enum DeprecationReason {
     DEPRECATED_DIRECT_TRANSLATION, DEPRECATED_MULTI_STAGE
   }
@@ -55,14 +55,14 @@ public class MultiStageMRConfToTezTranslator {
     int numEdges = totalStages - 1;
 
     Configuration[] allConfs = extractStageConfs(newConf, numEdges);
-    
+
     for (int i = 0; i < allConfs.length; i++) {
       setStageKeysFromBaseConf(allConfs[i], srcConf, Integer.toString(i));
       processDirectConversion(allConfs[i]);
     }
     for (int i = 0; i < allConfs.length - 1; i++) {
       processMultiStageDepreaction(allConfs[i], allConfs[i + 1]);
-      
+
     }
     // Unset unnecessary keys in the last stage. Will end up being called for
     // single stage as well which should be harmless.
@@ -163,29 +163,35 @@ public class MultiStageMRConfToTezTranslator {
     JobConf jobConf = new JobConf(baseConf);
     // Don't clobber explicit tez config.
     if (conf.get(TezJobConfig.TEZ_ENGINE_INTERMEDIATE_INPUT_KEY_CLASS) == null
-        && conf.get(TezJobConfig.TEZ_ENGINE_INTERMEDIATE_OUTPUT_KEY_CLASS) == null) {
+        && conf.get(TezJobConfig.TEZ_ENGINE_INTERMEDIATE_OUTPUT_KEY_CLASS)
+        == null) {
       // If this is set, but the comparator is not set, and their types differ -
       // the job will break.
       if (conf.get(MRJobConfig.MAP_OUTPUT_KEY_CLASS) == null) {
         // Pull tis in from the baseConf
         conf.set(MRJobConfig.MAP_OUTPUT_KEY_CLASS, jobConf
             .getMapOutputKeyClass().getName());
-        LOG.info("XXX: Setting " + MRJobConfig.MAP_OUTPUT_KEY_CLASS
-            + " for stage: " + stage
-            + " based on job level configuration. Value: "
-            + conf.get(MRJobConfig.MAP_OUTPUT_KEY_CLASS));
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("Setting " + MRJobConfig.MAP_OUTPUT_KEY_CLASS
+              + " for stage: " + stage
+              + " based on job level configuration. Value: "
+              + conf.get(MRJobConfig.MAP_OUTPUT_KEY_CLASS));
+        }
       }
     }
-    
+
     if (conf.get(TezJobConfig.TEZ_ENGINE_INTERMEDIATE_INPUT_VALUE_CLASS) == null
-        && conf.get(TezJobConfig.TEZ_ENGINE_INTERMEDIATE_OUTPUT_VALUE_CLASS) == null) {
+        && conf.get(TezJobConfig.TEZ_ENGINE_INTERMEDIATE_OUTPUT_VALUE_CLASS)
+        == null) {
       if (conf.get(MRJobConfig.MAP_OUTPUT_VALUE_CLASS) == null) {
         conf.set(MRJobConfig.MAP_OUTPUT_VALUE_CLASS, jobConf
             .getMapOutputValueClass().getName());
-        LOG.info("XXX: Setting " + MRJobConfig.MAP_OUTPUT_VALUE_CLASS
-            + " for stage: " + stage
-            + " based on job level configuration. Value: "
-            + conf.get(MRJobConfig.MAP_OUTPUT_VALUE_CLASS));
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("Setting " + MRJobConfig.MAP_OUTPUT_VALUE_CLASS
+              + " for stage: " + stage
+              + " based on job level configuration. Value: "
+              + conf.get(MRJobConfig.MAP_OUTPUT_VALUE_CLASS));
+        }
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/processor/MRTask.java
----------------------------------------------------------------------
diff --git a/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/processor/MRTask.java b/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/processor/MRTask.java
index 276294c..5683fa1 100644
--- a/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/processor/MRTask.java
+++ b/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/processor/MRTask.java
@@ -76,16 +76,16 @@ import org.apache.tez.mapreduce.hadoop.mapred.TaskAttemptContextImpl;
 import org.apache.tez.mapreduce.hadoop.mapreduce.JobContextImpl;
 import org.apache.tez.mapreduce.partition.MRPartitioner;
 
-public abstract class MRTask 
+public abstract class MRTask
 extends RunningTaskContext {
 
   static final Log LOG = LogFactory.getLog(MRTask.class);
-  
+
   protected JobConf jobConf;
   protected JobContext jobContext;
   protected TaskAttemptContext taskAttemptContext;
   protected OutputCommitter committer;
-  
+
   // Current counters
   transient TezCounters counters = new TezCounters();
   protected GcTimeUpdater gcUpdater;
@@ -93,10 +93,10 @@ extends RunningTaskContext {
   private long initCpuCumulativeTime = 0;
   protected TezEngineTaskContext tezEngineTaskContext;
   protected TezTaskAttemptID taskAttemptId;
-  
+
   /* flag to track whether task is done */
   AtomicBoolean taskDone = new AtomicBoolean(false);
-  
+
   /** Construct output file names so that, when an output directory listing is
    * sorted lexicographically, positions correspond to output partitions.*/
   private static final NumberFormat NUMBER_FORMAT = NumberFormat.getInstance();
@@ -104,16 +104,16 @@ extends RunningTaskContext {
     NUMBER_FORMAT.setMinimumIntegerDigits(5);
     NUMBER_FORMAT.setGroupingUsed(false);
   }
-                          
+
   private final static int MAX_RETRIES = 10;
 
   /** The number of milliseconds between progress reports. */
   public static final int PROGRESS_INTERVAL = 3000;
 
   private MRTaskReporter mrReporter;
-  
+
   protected TaskSplitIndex splitMetaInfo = new TaskSplitIndex();
-  
+
   /**
    * A Map where Key-> URIScheme and value->FileSystemStatisticUpdater
    */
@@ -129,7 +129,7 @@ extends RunningTaskContext {
         new MRTaskStatus(
             taskAttemptId,
             counters,
-            (taskAttemptId.getTaskID().getVertexID().getId() == 0 ? 
+            (taskAttemptId.getTaskID().getVertexID().getId() == 0 ?
                 Phase.MAP : Phase.SHUFFLE)
         );
     gcUpdater = new GcTimeUpdater(counters);
@@ -143,15 +143,15 @@ extends RunningTaskContext {
     } else {
       this.jobConf = new JobConf(conf);
     }
-    reporter = 
+    reporter =
         new TezTaskReporterImpl(this, (TezTaskUmbilicalProtocol)master);
     ((TezTaskReporterImpl)reporter).startCommunicationThread();
-    
-    jobConf.set(Constants.TEZ_ENGINE_TASK_ATTEMPT_ID, 
+
+    jobConf.set(Constants.TEZ_ENGINE_TASK_ATTEMPT_ID,
         taskAttemptId.toString());
 
     initResourceCalculatorPlugin();
-    
+
     LOG.info("MRTask.inited: taskAttemptId = " + taskAttemptId.toString());
   }
 
@@ -171,7 +171,7 @@ extends RunningTaskContext {
   public TezTaskUmbilicalProtocol getUmbilical() {
     return ((TezTaskReporterImpl)reporter).getUmbilical();
   }
-  
+
   public void initTask(JobConf job, TezDAGID dagId,
       MRTaskReporter mrReporter,
       boolean useNewApi) throws IOException,
@@ -203,18 +203,18 @@ extends RunningTaskContext {
     } else {
       setCommitter(job.getOutputCommitter());
     }
-    
+
     Path outputPath = FileOutputFormat.getOutputPath(job);
     if (outputPath != null) {
       if ((getCommitter() instanceof FileOutputCommitter)) {
-        FileOutputFormat.setWorkOutputPath(job, 
+        FileOutputFormat.setWorkOutputPath(job,
             ((FileOutputCommitter)getCommitter()).getTaskAttemptPath(taskAttemptContext));
       } else {
         FileOutputFormat.setWorkOutputPath(job, outputPath);
       }
     }
     getCommitter().setupTask(taskAttemptContext);
-    
+
     partitioner = new MRPartitioner(this);
     ((MRPartitioner)partitioner).initialize(job, getTaskReporter());
 
@@ -244,7 +244,7 @@ extends RunningTaskContext {
 
   public void setState(State state) {
     // TODO Auto-generated method stub
-    
+
   }
 
   public State getState() {
@@ -261,22 +261,22 @@ extends RunningTaskContext {
   }
 
   public TezCounters getCounters() { return counters; }
-  
+
   /**
-   * Return current phase of the task. 
+   * Return current phase of the task.
    * needs to be synchronized as communication thread sends the phase every second
    * @return the curent phase of the task
    */
   public synchronized TezTaskStatus.Phase getPhase(){
-    return status.getPhase(); 
+    return status.getPhase();
   }
-  
+
   /**
-   * Set current phase of the task. 
-   * @param phase task phase 
+   * Set current phase of the task.
+   * @param phase task phase
    */
   protected synchronized void setPhase(TezTaskStatus.Phase phase){
-    status.setPhase(phase); 
+    status.setPhase(phase);
   }
 
   public void setConf(JobConf jobConf) {
@@ -290,9 +290,9 @@ extends RunningTaskContext {
   /**
    * Gets a handle to the Statistics instance based on the scheme associated
    * with path.
-   * 
+   *
    * @param path the path.
-   * @param conf the configuration to extract the scheme from if not part of 
+   * @param conf the configuration to extract the scheme from if not part of
    *   the path.
    * @return a Statistics instance, or null if none is found for the scheme.
    */
@@ -313,7 +313,7 @@ extends RunningTaskContext {
   public synchronized String getOutputName() {
     return "part-" + NUMBER_FORMAT.format(taskAttemptId.getTaskID().getId());
   }
- 
+
   public void waitBeforeCompletion(MRTaskReporter reporter) throws IOException,
       InterruptedException {
     TezTaskUmbilicalProtocol umbilical = getUmbilical();
@@ -400,7 +400,7 @@ extends RunningTaskContext {
         } catch (InterruptedException ie) {
           // ignore
         } catch (IOException ie) {
-          LOG.warn("Failure sending commit pending: " + 
+          LOG.warn("Failure sending commit pending: " +
               StringUtils.stringifyException(ie));
           if (--retries == 0) {
             System.exit(67);
@@ -421,7 +421,7 @@ extends RunningTaskContext {
     sendDone(umbilical);
   }
 
-  
+
   private boolean isCommitRequired() throws IOException {
     return committer.needsTaskCommit(taskAttemptContext);
   }
@@ -444,7 +444,7 @@ extends RunningTaskContext {
       } catch (InterruptedException ie) {
         Thread.currentThread().interrupt(); // interrupt ourself
       } catch (IOException ie) {
-        LOG.warn("Failure sending status update: " + 
+        LOG.warn("Failure sending status update: " +
             StringUtils.stringifyException(ie));
         if (--retries == 0) {
           throw ie;
@@ -454,9 +454,9 @@ extends RunningTaskContext {
   }
 
   /**
-   * Sends last status update before sending umbilical.done(); 
+   * Sends last status update before sending umbilical.done();
    */
-  private void sendLastUpdate() 
+  private void sendLastUpdate()
       throws IOException, InterruptedException {
     status.setOutputSize(-1l);
     // send a final status report
@@ -485,7 +485,7 @@ extends RunningTaskContext {
         }
         break;
       } catch (IOException ie) {
-        LOG.warn("Failure asking whether task can commit: " + 
+        LOG.warn("Failure asking whether task can commit: " +
             StringUtils.stringifyException(ie));
         if (--retries == 0) {
           //if it couldn't query successfully then delete the output
@@ -495,13 +495,13 @@ extends RunningTaskContext {
       }
     }
 
-    // task can Commit now  
+    // task can Commit now
     try {
       LOG.info("Task " + taskAttemptId + " is allowed to commit now");
       committer.commitTask(taskAttemptContext);
       return;
     } catch (IOException iee) {
-      LOG.warn("Failure committing: " + 
+      LOG.warn("Failure committing: " +
           StringUtils.stringifyException(iee));
       //if it couldn't commit a successfully then delete the output
       discardOutput(taskAttemptContext);
@@ -509,12 +509,12 @@ extends RunningTaskContext {
     }
   }
 
-  private 
+  private
   void discardOutput(TaskAttemptContext taskContext) {
     try {
       committer.abortTask(taskContext);
     } catch (IOException ioe)  {
-      LOG.warn("Failure cleaning up: " + 
+      LOG.warn("Failure cleaning up: " +
                StringUtils.stringifyException(ioe));
     }
   }
@@ -528,7 +528,7 @@ extends RunningTaskContext {
         LOG.info("Task '" + taskAttemptId + "' done.");
         return;
       } catch (IOException ie) {
-        LOG.warn("Failure signalling completion: " + 
+        LOG.warn("Failure signalling completion: " +
                  StringUtils.stringifyException(ie));
         if (--retries == 0) {
           throw ie;
@@ -540,7 +540,7 @@ extends RunningTaskContext {
   public void updateCounters() {
     // TODO Auto-generated method stub
     // TODO TEZAM Implement.
-    Map<String, List<FileSystem.Statistics>> map = new 
+    Map<String, List<FileSystem.Statistics>> map = new
         HashMap<String, List<FileSystem.Statistics>>();
     for(Statistics stat: FileSystem.getAllStatistics()) {
       String uriScheme = stat.getScheme();
@@ -563,7 +563,7 @@ extends RunningTaskContext {
       }
       updater.updateCounters();
     }
-    
+
     gcUpdater.incrementGcCounter();
     updateResourceCounters();
   }
@@ -599,7 +599,7 @@ extends RunningTaskContext {
     counters.findCounter(TaskCounter.PHYSICAL_MEMORY_BYTES).setValue(pMem);
     counters.findCounter(TaskCounter.VIRTUAL_MEMORY_BYTES).setValue(vMem);
   }
-  
+
 
   public static String normalizeStatus(String status, Configuration conf) {
     // Check to see if the status string is too long
@@ -614,75 +614,78 @@ extends RunningTaskContext {
     }
     return status;
   }
-  
-  protected static <INKEY,INVALUE,OUTKEY,OUTVALUE> 
+
+  protected static <INKEY,INVALUE,OUTKEY,OUTVALUE>
   org.apache.hadoop.mapreduce.Reducer<INKEY,INVALUE,OUTKEY,OUTVALUE>.Context
   createReduceContext(org.apache.hadoop.mapreduce.Reducer
                         <INKEY,INVALUE,OUTKEY,OUTVALUE> reducer,
                       Configuration job,
-                      TezTaskAttemptID taskId, 
+                      TezTaskAttemptID taskId,
                       final TezRawKeyValueIterator rIter,
                       org.apache.hadoop.mapreduce.Counter inputKeyCounter,
                       org.apache.hadoop.mapreduce.Counter inputValueCounter,
-                      org.apache.hadoop.mapreduce.RecordWriter<OUTKEY,OUTVALUE> output, 
+                      org.apache.hadoop.mapreduce.RecordWriter<OUTKEY,OUTVALUE> output,
                       org.apache.hadoop.mapreduce.OutputCommitter committer,
                       org.apache.hadoop.mapreduce.StatusReporter reporter,
                       RawComparator<INKEY> comparator,
                       Class<INKEY> keyClass, Class<INVALUE> valueClass
   ) throws IOException, InterruptedException {
-    RawKeyValueIterator r = 
+    RawKeyValueIterator r =
         new RawKeyValueIterator() {
-          
+
           @Override
           public boolean next() throws IOException {
             return rIter.next();
           }
-          
+
           @Override
           public DataInputBuffer getValue() throws IOException {
             return rIter.getValue();
           }
-          
+
           @Override
           public Progress getProgress() {
             return rIter.getProgress();
           }
-          
+
           @Override
           public DataInputBuffer getKey() throws IOException {
             return rIter.getKey();
           }
-          
+
           @Override
           public void close() throws IOException {
             rIter.close();
           }
         };
-    org.apache.hadoop.mapreduce.ReduceContext<INKEY, INVALUE, OUTKEY, OUTVALUE> 
-    reduceContext = 
+    org.apache.hadoop.mapreduce.ReduceContext<INKEY, INVALUE, OUTKEY, OUTVALUE>
+    reduceContext =
       new ReduceContextImpl<INKEY, INVALUE, OUTKEY, OUTVALUE>(
-          job, 
-          IDConverter.toMRTaskAttemptId(taskId), 
-          r, 
-          inputKeyCounter, 
-          inputValueCounter, 
-          output, 
-          committer, 
-          reporter, 
-          comparator, 
-          keyClass, 
+          job,
+          IDConverter.toMRTaskAttemptId(taskId),
+          r,
+          inputKeyCounter,
+          inputValueCounter,
+          output,
+          committer,
+          reporter,
+          comparator,
+          keyClass,
           valueClass);
-    LOG.info("DEBUG: Using key class: " + keyClass + ", valueClass: " + valueClass);
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Using key class: " + keyClass
+          + ", valueClass: " + valueClass);
+    }
 
-    org.apache.hadoop.mapreduce.Reducer<INKEY,INVALUE,OUTKEY,OUTVALUE>.Context 
-        reducerContext = 
+    org.apache.hadoop.mapreduce.Reducer<INKEY,INVALUE,OUTKEY,OUTVALUE>.Context
+        reducerContext =
           new WrappedReducer<INKEY, INVALUE, OUTKEY, OUTVALUE>().getReducerContext(
               reduceContext);
 
     return reducerContext;
   }
 
-  public void taskCleanup(TezTaskUmbilicalProtocol umbilical) 
+  public void taskCleanup(TezTaskUmbilicalProtocol umbilical)
       throws IOException, InterruptedException {
     // set phase for this task
     setPhase(TezTaskStatus.Phase.CLEANUP);
@@ -693,13 +696,13 @@ extends RunningTaskContext {
     committer.abortTask(taskAttemptContext);
   }
 
-  public void localizeConfiguration(JobConf jobConf) 
+  public void localizeConfiguration(JobConf jobConf)
       throws IOException, InterruptedException {
     jobConf.set(JobContext.TASK_ID, IDConverter
         .toMRTaskAttemptId(taskAttemptId).toString());
     jobConf.set(JobContext.TASK_ATTEMPT_ID,
         IDConverter.toMRTaskAttemptId(taskAttemptId).toString());
-    jobConf.setInt(JobContext.TASK_PARTITION, 
+    jobConf.setInt(JobContext.TASK_PARTITION,
         taskAttemptId.getTaskID().getId());
     jobConf.set(JobContext.ID, taskAttemptId.getTaskID().getVertexID().getDAGId().toString());
   }
@@ -727,11 +730,11 @@ extends RunningTaskContext {
   public JobContext getJobContext() {
     return jobContext;
   }
-  
+
   public TezTaskAttemptID getTaskAttemptId() {
     return taskAttemptId;
   }
-  
+
   public TezEngineTaskContext getTezEngineTaskContext() {
     return tezEngineTaskContext;
   }

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-yarn-client/src/main/java/org/apache/tez/mapreduce/YARNRunner.java
----------------------------------------------------------------------
diff --git a/tez-yarn-client/src/main/java/org/apache/tez/mapreduce/YARNRunner.java b/tez-yarn-client/src/main/java/org/apache/tez/mapreduce/YARNRunner.java
index e2ef5b6..05b5411 100644
--- a/tez-yarn-client/src/main/java/org/apache/tez/mapreduce/YARNRunner.java
+++ b/tez-yarn-client/src/main/java/org/apache/tez/mapreduce/YARNRunner.java
@@ -322,12 +322,10 @@ public class YARNRunner implements ClientProtocol {
   private TaskLocationHint[] getMapLocationHintsFromInputSplits(JobID jobId,
       FileSystem fs, Configuration conf,
       String jobSubmitDir) throws IOException {
-    LOG.info("XXXX Reading splits information");
     TaskSplitMetaInfo[] splitsInfo =
         SplitMetaInfoReader.readSplitMetaInfo(jobId, fs, conf,
             new Path(jobSubmitDir));
     int splitsCount = splitsInfo.length;
-    LOG.info("XXXX Found splits information, splitCount=" + splitsCount);
     TaskLocationHint[] locationHints =
         new TaskLocationHint[splitsCount];
     for (int i = 0; i < splitsCount; ++i) {
@@ -462,11 +460,13 @@ public class YARNRunner implements ClientProtocol {
     Apps.addToEnvironment(environment, Environment.CLASSPATH.name(),
         getInitialClasspath(conf));
 
-    LOG.info("XXXX Dumping out env for child, isMap=" + isMap);
-    for (Map.Entry<String, String> entry : environment.entrySet()) {
-      LOG.info("XXXX env entry: "
-          + entry.getKey()
-          + "=" + entry.getValue());
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Dumping out env for child, isMap=" + isMap);
+      for (Map.Entry<String, String> entry : environment.entrySet()) {
+        LOG.debug("Child env entry: "
+            + entry.getKey()
+            + "=" + entry.getValue());
+      }
     }
   }
 
@@ -518,11 +518,13 @@ public class YARNRunner implements ClientProtocol {
           jobLocalResources, i);
       dag.addVertex(vertices[i]);
 
-      LOG.info("XXXX Adding intermediate vertex to DAG"
-          + ", vertexName=" + vertices[i].getVertexName()
-          + ", processor=" + vertices[i].getProcessorName()
-          + ", parrellism=" + vertices[i].getParallelism()
-          + ", javaOpts=" + vertices[i].getJavaOpts());
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("Adding intermediate vertex to DAG"
+            + ", vertexName=" + vertices[i].getVertexName()
+            + ", processor=" + vertices[i].getProcessorName()
+            + ", parrellism=" + vertices[i].getParallelism()
+            + ", javaOpts=" + vertices[i].getJavaOpts());
+      }
     }
     return vertices;
   }
@@ -540,10 +542,12 @@ public class YARNRunner implements ClientProtocol {
 
     boolean isMRR = (intermediateReduces > 0);
 
-    LOG.info("XXXX Parsing job config"
-        + ", numMaps=" + numMaps
-        + ", numReduces=" + numReduces
-        + ", intermediateReduceStages=" + intermediateReduces);
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Parsing job config"
+          + ", numMaps=" + numMaps
+          + ", numReduces=" + numReduces
+          + ", intermediateReduceStages=" + intermediateReduces);
+    }
 
     // configure map vertex
     String mapProcessor = "org.apache.tez.mapreduce.processor.map.MapProcessor";
@@ -575,11 +579,13 @@ public class YARNRunner implements ClientProtocol {
 
     mapVertex.setJavaOpts(getMapJavaOpts(jobConf));
 
-    LOG.info("XXXX Adding map vertex to DAG"
-        + ", vertexName=" + mapVertex.getVertexName()
-        + ", processor=" + mapVertex.getProcessorName()
-        + ", parrellism=" + mapVertex.getParallelism()
-        + ", javaOpts=" + mapVertex.getJavaOpts());
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Adding map vertex to DAG"
+          + ", vertexName=" + mapVertex.getVertexName()
+          + ", processor=" + mapVertex.getProcessorName()
+          + ", parrellism=" + mapVertex.getParallelism()
+          + ", javaOpts=" + mapVertex.getJavaOpts());
+    }
     dag.addVertex(mapVertex);
 
     Vertex[] intermediateVertices = null;
@@ -618,11 +624,13 @@ public class YARNRunner implements ClientProtocol {
 
       reduceVertex.setJavaOpts(getReduceJavaOpts(jobConf));
 
-      LOG.info("XXXX Adding reduce vertex to DAG"
-          + ", vertexName=" + reduceVertex.getVertexName()
-          + ", processor=" + reduceVertex.getProcessorName()
-          + ", parrellism=" + reduceVertex.getParallelism()
-          + ", javaOpts=" + reduceVertex.getJavaOpts());
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("Adding reduce vertex to DAG"
+            + ", vertexName=" + reduceVertex.getVertexName()
+            + ", processor=" + reduceVertex.getProcessorName()
+            + ", parrellism=" + reduceVertex.getParallelism()
+            + ", javaOpts=" + reduceVertex.getJavaOpts());
+      }
       dag.addVertex(reduceVertex);
 
       EdgeProperty edgeProperty =
@@ -672,7 +680,9 @@ public class YARNRunner implements ClientProtocol {
     Map<String, String> mrParamToDAGParamMap = DeprecatedKeys.getMRToDAGParamMap();
     for (Entry<String, String> entry : mrParamToDAGParamMap.entrySet()) {
       if (mrConf.get(entry.getKey()) != null) {
-        LOG.info("DEBUG: MR->DAG Setting new key: " + entry.getValue());
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("MR->DAG Setting new key: " + entry.getValue());
+        }
         dag.addConfiguration(entry.getValue(), mrConf.get(entry.getKey()));
       }
     }


[2/2] git commit: TEZ-175. Cleanup logs.

Posted by hi...@apache.org.
TEZ-175. Cleanup logs.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tez/commit/9feab053
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tez/tree/9feab053
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tez/diff/9feab053

Branch: refs/heads/TEZ-1
Commit: 9feab053fc0508f9ec6b791db8afdd4eebc11113
Parents: 9f040cf
Author: Hitesh Shah <hi...@apache.org>
Authored: Mon Jun 3 16:42:28 2013 -0700
Committer: Hitesh Shah <hi...@apache.org>
Committed: Mon Jun 3 16:46:40 2013 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/mapred/YarnTezDagChild.java  |   31 ++--
 .../java/org/apache/tez/dag/app/DAGAppMaster.java  |  102 +++++-----
 .../tez/dag/app/TaskAttemptListenerImpTezDag.java  |   60 +++---
 .../org/apache/tez/dag/app/dag/impl/DAGImpl.java   |   60 +++---
 .../tez/dag/app/dag/impl/TaskAttemptImpl.java      |  104 +++++-----
 .../org/apache/tez/dag/app/dag/impl/TaskImpl.java  |  164 ++++++++-------
 .../apache/tez/dag/app/dag/impl/VertexImpl.java    |   36 ++--
 .../tez/dag/app/rm/container/AMContainerImpl.java  |   89 +++++----
 .../org/apache/tez/dag/app/rm/node/AMNodeImpl.java |   24 ++-
 .../engine/common/shuffle/impl/InMemoryWriter.java |   46 ++--
 .../engine/common/sort/impl/ExternalSorter.java    |   38 ++--
 .../engine/common/sort/impl/IFileOutputStream.java |   14 +-
 .../common/sort/impl/dflt/DefaultSorter.java       |   88 ++++----
 .../task/local/output/TezTaskOutputFiles.java      |   38 ++--
 .../engine/lib/output/LocalOnFileSorterOutput.java |   12 +-
 .../apache/tez/engine/runtime/RuntimeUtils.java    |   29 ++-
 .../org/apache/hadoop/mapred/LocalJobRunner.java   |  122 ++++++------
 .../mapreduce/split/SplitMetaInfoReaderTez.java    |   12 +-
 .../apache/tez/mapreduce/combine/MRCombiner.java   |    7 +-
 .../hadoop/MultiStageMRConfToTezTranslator.java    |   34 ++--
 .../org/apache/tez/mapreduce/processor/MRTask.java |  147 +++++++-------
 .../java/org/apache/tez/mapreduce/YARNRunner.java  |   64 ++++---
 22 files changed, 686 insertions(+), 635 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-dag/src/main/java/org/apache/hadoop/mapred/YarnTezDagChild.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/hadoop/mapred/YarnTezDagChild.java b/tez-dag/src/main/java/org/apache/hadoop/mapred/YarnTezDagChild.java
index 6fd6eff..33e3972 100644
--- a/tez-dag/src/main/java/org/apache/hadoop/mapred/YarnTezDagChild.java
+++ b/tez-dag/src/main/java/org/apache/hadoop/mapred/YarnTezDagChild.java
@@ -146,9 +146,10 @@ public class YarnTezDagChild {
         }
         taskContext = (TezEngineTaskContext) containerTask
             .getTezEngineTaskContext();
-        LOG.info("DEBUG: New container task context:"
-                + taskContext.toString());
-
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("New container task context:"
+              + taskContext.toString());
+        }
         taskAttemptId = taskContext.getTaskAttemptId();
 
         final Task t = createAndConfigureTezTask(taskContext, umbilical,
@@ -200,25 +201,25 @@ public class YarnTezDagChild {
   /**
    * Configure mapred-local dirs. This config is used by the task for finding
    * out an output directory.
-   * @throws IOException 
+   * @throws IOException
    */
   /**
    * Configure tez-local-dirs, tez-localized-file-dir, etc. Also create these
    * dirs.
    */
-  
+
   private static void configureLocalDirs(Configuration conf) throws IOException {
     String[] localSysDirs = StringUtils.getTrimmedStrings(
         System.getenv(Environment.LOCAL_DIRS.name()));
     conf.setStrings(TezJobConfig.LOCAL_DIRS, localSysDirs);
     conf.set(TezJobConfig.TASK_LOCAL_RESOURCE_DIR,
         System.getenv(Environment.PWD.name()));
-    
+
     LOG.info(TezJobConfig.LOCAL_DIRS + " for child: " +
         conf.get(TezJobConfig.LOCAL_DIRS));
     LOG.info(TezJobConfig.TASK_LOCAL_RESOURCE_DIR + " for child: "
         + conf.get(TezJobConfig.TASK_LOCAL_RESOURCE_DIR));
-    
+
     LocalDirAllocator lDirAlloc = new LocalDirAllocator(TezJobConfig.LOCAL_DIRS);
     Path workDir = null;
     // First, try to find the JOB_LOCAL_DIR on this host.
@@ -250,7 +251,7 @@ public class YarnTezDagChild {
     }
     conf.set(TezJobConfig.JOB_LOCAL_DIR, workDir.toString());
   }
-  
+
   private static Task createAndConfigureTezTask(
       TezEngineTaskContext taskContext, TezTaskUmbilicalProtocol master,
       Credentials cxredentials, Token<JobTokenIdentifier> jobToken,
@@ -260,10 +261,10 @@ public class YarnTezDagChild {
     // set tcp nodelay
     conf.setBoolean("ipc.client.tcpnodelay", true);
     conf.setInt(TezJobConfig.APPLICATION_ATTEMPT_ID, appAttemptId);
-    
+
     configureLocalDirs(conf);
-    
-    
+
+
     // FIXME need Input/Output vertices else we have this hack
     if (taskContext.getInputSpecList().isEmpty()) {
       taskContext.getInputSpecList().add(
@@ -281,18 +282,18 @@ public class YarnTezDagChild {
     // and processor then inits inputs and outputs
     return t;
   }
-  
+
   private static void runTezTask(
-      Task t, TezTaskUmbilicalProtocol master, Configuration conf) 
+      Task t, TezTaskUmbilicalProtocol master, Configuration conf)
   throws IOException, InterruptedException {
     // use job-specified working directory
     FileSystem.get(conf).setWorkingDirectory(getWorkingDirectory(conf));
-    
+
     // Run!
     t.run();
     t.close();
   }
-  
+
   private static Path getWorkingDirectory(Configuration conf) {
     String name = conf.get(JobContext.WORKING_DIR);
     if (name != null) {

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java b/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
index 821dd71..a4ca97e 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
@@ -128,7 +128,7 @@ import org.apache.tez.engine.common.security.JobTokenSecretManager;
 
 @SuppressWarnings("rawtypes")
 public class DAGAppMaster extends CompositeService {
-  
+
   private static final Log LOG = LogFactory.getLog(DAGAppMaster.class);
 
   /**
@@ -137,7 +137,7 @@ public class DAGAppMaster extends CompositeService {
   public static final int SHUTDOWN_HOOK_PRIORITY = 30;
 
   private Clock clock;
-  private final DAGPlan jobPlan;
+  private final DAGPlan dagPlan;
   private long dagsStartTime;
   private final long startTime;
   private final long appSubmitTime;
@@ -154,7 +154,7 @@ public class DAGAppMaster extends CompositeService {
   // TODO Recovery
   //private Map<TezTaskID, TaskInfo> completedTasksFromPreviousRun;
   private AppContext context;
-  private TezConfiguration conf; 
+  private TezConfiguration conf;
   private Dispatcher dispatcher;
   // TODO Recovery
   //private Recovery recoveryServ;
@@ -176,7 +176,7 @@ public class DAGAppMaster extends CompositeService {
   private HistoryEventHandler historyEventHandler;
 
   private DAGAppMasterState state;
-  
+
   DAGClientServer clientRpcServer;
   private DAGClientHandler clientHandler;
 
@@ -195,7 +195,7 @@ public class DAGAppMaster extends CompositeService {
       ContainerId containerId, String nmHost, int nmPort, int nmHttpPort,
       Clock clock, long appSubmitTime, DAGPlan dagPB) {
     super(DAGAppMaster.class.getName());
-    this.jobPlan = dagPB;
+    this.dagPlan = dagPB;
     this.clock = clock;
     this.startTime = clock.getTime();
     this.appSubmitTime = appSubmitTime;
@@ -214,9 +214,9 @@ public class DAGAppMaster extends CompositeService {
   public void init(final Configuration tezConf) {
 
     this.state = DAGAppMasterState.INITED;
-    
+
     assert tezConf instanceof TezConfiguration;
-    
+
     this.conf = (TezConfiguration) tezConf;
     conf.setBoolean(Dispatcher.DISPATCHER_EXIT_ON_ERROR_KEY, true);
 
@@ -226,10 +226,10 @@ public class DAGAppMaster extends CompositeService {
 
     // Job name is the same as the app name util we support DAG of jobs
     // for an app later
-    appName = jobPlan.getName();
+    appName = dagPlan.getName();
 
     dagId = new TezDAGID(appAttemptID.getApplicationId(), 1);
-    
+
     clientHandler = new DAGClientHandler();
 
     // TODO Committer.
@@ -237,7 +237,7 @@ public class DAGAppMaster extends CompositeService {
 
     dispatcher = createDispatcher();
     addIfService(dispatcher);
-    
+
     clientRpcServer = new DAGClientServer(clientHandler);
     addIfService(clientRpcServer);
 
@@ -432,7 +432,7 @@ public class DAGAppMaster extends CompositeService {
       LOG.warn("No handler for event type: " + event.getType());
     }
   }
-  
+
   private class DAGAppMasterEventHandler implements
       EventHandler<DAGAppMasterEvent> {
     @Override
@@ -440,7 +440,7 @@ public class DAGAppMaster extends CompositeService {
       DAGAppMaster.this.handle(event);
     }
   }
-  
+
   private class DAGFinishEventHandler implements EventHandler<DAGFinishEvent> {
     @Override
     public void handle(DAGFinishEvent event) {
@@ -466,9 +466,9 @@ public class DAGAppMaster extends CompositeService {
     */
       // TODO:currently just wait for some time so clients can know the
       // final states. Will be removed once RM come on.
-     
+
       setStateOnDAGCompletion();
-      
+
       try {
         Thread.sleep(5000);
       } catch (InterruptedException e) {
@@ -660,19 +660,19 @@ public class DAGAppMaster extends CompositeService {
   public TaskAttemptListener getTaskAttemptListener() {
     return taskAttemptListener;
   }
-  
+
   public ContainerId getAppContainerId() {
     return containerID;
   }
-  
+
   public String getAppNMHost() {
     return nmHost;
   }
-  
+
   public int getAppNMPort() {
     return nmPort;
   }
-  
+
   public int getAppNMHttpPort() {
     return nmHttpPort;
   }
@@ -680,15 +680,15 @@ public class DAGAppMaster extends CompositeService {
   public DAGAppMasterState getState() {
     return state;
   }
-  
+
   public List<String> getDiagnostics() {
     return dag.getDiagnostics();
   }
-  
+
   public float getProgress() {
     return dag.getProgress();
   }
-  
+
   void setStateOnDAGCompletion() {
     DAGAppMasterState oldState = state;
     if(state == DAGAppMasterState.RUNNING) {
@@ -709,7 +709,7 @@ public class DAGAppMaster extends CompositeService {
     }
     LOG.info("On DAG completion. Old state: " + oldState + " new state: " + state);
   }
-  
+
   class DAGClientHandler implements DAGClient {
 
     @Override
@@ -718,22 +718,22 @@ public class DAGAppMaster extends CompositeService {
     }
 
     @Override
-    public DAGStatus getDAGStatus(String dagIdStr) 
+    public DAGStatus getDAGStatus(String dagIdStr)
                                       throws IOException, TezRemoteException {
       return getDAG(dagIdStr).getDAGStatus();
     }
 
     @Override
-    public VertexStatus getVertexStatus(String dagIdStr, String vertexName) 
+    public VertexStatus getVertexStatus(String dagIdStr, String vertexName)
         throws IOException, TezRemoteException{
       VertexStatus status = getDAG(dagIdStr).getVertexStatus(vertexName);
       if(status == null) {
         throw new TezRemoteException("Unknown vertexName: " + vertexName);
       }
-      
+
       return status;
     }
-    
+
     DAG getDAG(String dagIdStr) throws IOException, TezRemoteException {
       TezDAGID dagId = TezDAGID.fromString(dagIdStr);
       if(dagId == null) {
@@ -759,11 +759,11 @@ public class DAGAppMaster extends CompositeService {
       this.conf = config;
     }
 
-    @Override 
+    @Override
     public DAGAppMaster getAppMaster() {
       return DAGAppMaster.this;
     }
-    
+
     @Override
     public ApplicationAttemptId getApplicationAttemptId() {
       return appAttemptID;
@@ -859,7 +859,7 @@ public class DAGAppMaster extends CompositeService {
   public void start() {
 
     this.state = DAGAppMasterState.RUNNING;
-    
+
     // TODO Recovery
     // Pull completedTasks etc from recovery
     /*
@@ -868,9 +868,9 @@ public class DAGAppMaster extends CompositeService {
       amInfos = recoveryServ.getAMInfos();
     }
     */
-    
+
     // /////////////////// Create the job itself.
-    dag = createDAG(jobPlan);
+    dag = createDAG(dagPlan);
 
     // End of creating the job.
 
@@ -893,7 +893,7 @@ public class DAGAppMaster extends CompositeService {
         startTime, dagsStartTime, appSubmitTime);
     dispatcher.getEventHandler().handle(
         new DAGHistoryEvent(this.dagId, startEvent));
-    
+
     // All components have started, start the job.
     startDags();
   }
@@ -922,7 +922,7 @@ public class DAGAppMaster extends CompositeService {
       ((EventHandler<DAGEvent>)context.getDAG()).handle(event);
     }
   }
-  
+
   private class TaskEventDispatcher implements EventHandler<TaskEvent> {
     @SuppressWarnings("unchecked")
     @Override
@@ -959,7 +959,7 @@ public class DAGAppMaster extends CompositeService {
       ((EventHandler<VertexEvent>) vertex).handle(event);
     }
   }
-  
+
   private static void validateInputParam(String value, String param)
       throws IOException {
     if (value == null) {
@@ -998,22 +998,22 @@ public class DAGAppMaster extends CompositeService {
       // TODO change this once the client is ready.
       String type;
       TezConfiguration conf = new TezConfiguration(new YarnConfiguration());
-      
-      DAGPlan jobPlan = null;
+
+      DAGPlan dagPlan = null;
       if (cliParser.hasOption(OPT_PREDEFINED)) {
         LOG.info("Running with PreDefined configuration");
         type = cliParser.getOptionValue(OPT_PREDEFINED, "mr");
         LOG.info("Running job type: " + type);
 
         if (type.equals("mr")) {
-          jobPlan = MRRExampleHelper.createDAGConfigurationForMR();
+          dagPlan = MRRExampleHelper.createDAGConfigurationForMR();
         } else if (type.equals("mrr")) {
-          jobPlan = MRRExampleHelper.createDAGConfigurationForMRR();
+          dagPlan = MRRExampleHelper.createDAGConfigurationForMRR();
         }
-      } 
+      }
       else {
         // Read the protobuf DAG
-        DAGPlan.Builder dagPlanBuilder = DAGPlan.newBuilder(); 
+        DAGPlan.Builder dagPlanBuilder = DAGPlan.newBuilder();
         FileInputStream dagPBBinaryStream = null;
         try {
           dagPBBinaryStream = new FileInputStream(TezConfiguration.DAG_AM_PLAN_PB_BINARY);
@@ -1021,17 +1021,19 @@ public class DAGAppMaster extends CompositeService {
         }
         finally {
           if(dagPBBinaryStream != null){
-            dagPBBinaryStream.close();  
+            dagPBBinaryStream.close();
           }
         }
 
-        jobPlan = dagPlanBuilder.build();
+        dagPlan = dagPlanBuilder.build();
       }
 
-      LOG.info("XXXX Running a DAG with "
-          + jobPlan.getVertexCount() + " vertices ");
-      for (VertexPlan v : jobPlan.getVertexList()) {
-        LOG.info("XXXX DAG has vertex " + v.getName());
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("Running a DAG with "
+            + dagPlan.getVertexCount() + " vertices ");
+        for (VertexPlan v : dagPlan.getVertexList()) {
+          LOG.debug("DAG has vertex " + v.getName());
+        }
       }
 
       String jobUserName = System
@@ -1041,8 +1043,8 @@ public class DAGAppMaster extends CompositeService {
       // SIGTERM I have a chance to write out the job history. I'll be closing
       // the objects myself.
       conf.setBoolean("fs.automatic.close", false);
-      
-      Map<String, String> config = DagTypeConverters.createSettingsMapFromDAGPlan(jobPlan.getJobSettingList());
+
+      Map<String, String> config = DagTypeConverters.createSettingsMapFromDAGPlan(dagPlan.getJobSettingList());
       for(Entry<String, String> entry : config.entrySet()) {
         conf.set(entry.getKey(), entry.getValue());
       }
@@ -1050,7 +1052,7 @@ public class DAGAppMaster extends CompositeService {
       DAGAppMaster appMaster =
           new DAGAppMaster(applicationAttemptId, containerId, nodeHostString,
               Integer.parseInt(nodePortString),
-              Integer.parseInt(nodeHttpPortString), appSubmitTime, jobPlan);
+              Integer.parseInt(nodeHttpPortString), appSubmitTime, dagPlan);
       ShutdownHookManager.get().addShutdownHook(
         new DAGAppMasterShutdownHook(appMaster), SHUTDOWN_HOOK_PRIORITY);
 
@@ -1117,7 +1119,7 @@ public class DAGAppMaster extends CompositeService {
       }
     });
   }
-  
+
   @SuppressWarnings("unchecked")
   private void sendEvent(Event<?> event) {
     dispatcher.getEventHandler().handle(event);

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-dag/src/main/java/org/apache/tez/dag/app/TaskAttemptListenerImpTezDag.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/TaskAttemptListenerImpTezDag.java b/tez-dag/src/main/java/org/apache/tez/dag/app/TaskAttemptListenerImpTezDag.java
index 7600db4..708b33e 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/TaskAttemptListenerImpTezDag.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/TaskAttemptListenerImpTezDag.java
@@ -5,9 +5,9 @@
  * licenses this file to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -67,7 +67,7 @@ public class TaskAttemptListenerImpTezDag extends AbstractService implements
 
   private static final ContainerTask TASK_FOR_INVALID_JVM = new ContainerTask(
       null, true);
-  
+
   private static ProceedToCompletionResponse COMPLETION_RESPONSE_NO_WAIT =
       new ProceedToCompletionResponse(true, true);
 
@@ -86,10 +86,10 @@ public class TaskAttemptListenerImpTezDag extends AbstractService implements
   // TODO Use this to figure out whether an incoming ping is valid.
   private ConcurrentMap<TezTaskAttemptID, ContainerId> attemptToContainerIdMap =
       new ConcurrentHashMap<TezTaskAttemptID, ContainerId>();
-  
+
   private Set<ContainerId> registeredContainers = Collections
       .newSetFromMap(new ConcurrentHashMap<ContainerId, Boolean>());
-  
+
   public TaskAttemptListenerImpTezDag(AppContext context,
       TaskHeartbeatHandler thh, ContainerHeartbeatHandler chh,
       JobTokenSecretManager jobTokenSecretManager) {
@@ -118,10 +118,10 @@ public class TaskAttemptListenerImpTezDag extends AbstractService implements
               conf.getInt(TezConfiguration.DAG_AM_TASK_LISTENER_THREAD_COUNT,
                   TezConfiguration.DAG_AM_TASK_LISTENER_THREAD_COUNT_DEFAULT))
           .setSecretManager(jobTokenSecretManager).build();
-      
+
       // Enable service authorization?
       if (conf.getBoolean(
-          CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, 
+          CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,
           false)) {
         refreshServiceAcls(conf, new MRAMPolicyProvider());
       }
@@ -133,7 +133,7 @@ public class TaskAttemptListenerImpTezDag extends AbstractService implements
     }
   }
 
-  void refreshServiceAcls(Configuration configuration, 
+  void refreshServiceAcls(Configuration configuration,
       PolicyProvider policyProvider) {
     this.server.refreshServiceAcl(configuration, policyProvider);
   }
@@ -153,7 +153,7 @@ public class TaskAttemptListenerImpTezDag extends AbstractService implements
   public InetSocketAddress getAddress() {
     return address;
   }
-  
+
   @Override
   public long getProtocolVersion(String protocol, long clientVersion)
       throws IOException {
@@ -171,13 +171,13 @@ public class TaskAttemptListenerImpTezDag extends AbstractService implements
   public TezTaskDependencyCompletionEventsUpdate getDependentTasksCompletionEvents(
       int fromEventIdx, int maxEvents,
       TezTaskAttemptID taskAttemptID) {
-    
+
     LOG.info("Dependency Completion Events request from " + taskAttemptID
         + ". fromEventID " + fromEventIdx + " maxEvents " + maxEvents);
 
     // TODO: shouldReset is never used. See TT. Ask for Removal.
     boolean shouldReset = false;
-    TezDependentTaskCompletionEvent[] events = 
+    TezDependentTaskCompletionEvent[] events =
         context.getDAG().
             getVertex(taskAttemptID.getTaskID().getVertexID()).
                 getTaskAttemptCompletionEvents(fromEventIdx, maxEvents);
@@ -234,22 +234,28 @@ public class TaskAttemptListenerImpTezDag extends AbstractService implements
         }
       }
     }
-    LOG.info("DEBUG: getTask returning task: " + task);
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("getTask returning task: " + task);
+    }
     return task;
   }
 
   @Override
   public boolean statusUpdate(TezTaskAttemptID taskAttemptId,
       TezTaskStatus taskStatus) throws IOException, InterruptedException {
-    LOG.info("DEBUG: " + "Status update from: " + taskAttemptId);
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Status update from: " + taskAttemptId);
+    }
     taskHeartbeatHandler.progressing(taskAttemptId);
     pingContainerHeartbeatHandler(taskAttemptId);
     TaskAttemptStatus taskAttemptStatus = new TaskAttemptStatus();
     taskAttemptStatus.id = taskAttemptId;
     // Task sends the updated progress to the TT.
     taskAttemptStatus.progress = taskStatus.getProgress();
-    LOG.info("DEBUG: " + "Progress of TaskAttempt " + taskAttemptId + " is : "
-        + taskStatus.getProgress());
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Progress of TaskAttempt " + taskAttemptId + " is : "
+          + taskStatus.getProgress());
+    }
 
     // Task sends the updated state-string to the TT.
     taskAttemptStatus.stateString = taskStatus.getStateString();
@@ -267,7 +273,7 @@ public class TaskAttemptListenerImpTezDag extends AbstractService implements
     // that is the primary storage format inside the AM to avoid multiple
     // conversions and unnecessary heap usage.
     taskAttemptStatus.counters = taskStatus.getCounters();
-    
+
 
     // Map Finish time set by the task (map only)
     // TODO CLEANMRXAM - maybe differentiate between map / reduce / types
@@ -366,7 +372,7 @@ public class TaskAttemptListenerImpTezDag extends AbstractService implements
   /**
    * TaskAttempt is reporting that it is in commit_pending and it is waiting for
    * the commit Response
-   * 
+   *
    * <br/>
    * Commit it a two-phased protocol. First the attempt informs the
    * ApplicationMaster that it is
@@ -386,14 +392,14 @@ public class TaskAttemptListenerImpTezDag extends AbstractService implements
     //Ignorable TaskStatus? - since a task will send a LastStatusUpdate
     context.getEventHandler().handle(
         new TaskAttemptEvent(
-            taskAttemptId, 
+            taskAttemptId,
             TaskAttemptEventType.TA_COMMIT_PENDING)
         );
   }
 
   /**
    * Child checking whether it can commit.
-   * 
+   *
    * <br/>
    * Commit is a two-phased protocol. First the attempt informs the
    * ApplicationMaster that it is
@@ -411,7 +417,7 @@ public class TaskAttemptListenerImpTezDag extends AbstractService implements
     pingContainerHeartbeatHandler(taskAttemptId);
 
     DAG job = context.getDAG();
-    Task task = 
+    Task task =
         job.getVertex(taskAttemptId.getTaskID().getVertexID()).
             getTask(taskAttemptId.getTaskID());
     return task.canCommit(taskAttemptId);
@@ -459,16 +465,16 @@ public class TaskAttemptListenerImpTezDag extends AbstractService implements
   @Override
   public ProceedToCompletionResponse
       proceedToCompletion(TezTaskAttemptID taskAttemptId) throws IOException {
-    
+
     // The async nature of the processing combined with the 1 second interval
     // between polls (MRTask) implies tasks end up wasting upto 1 second doing
     // nothing. Similarly for CA_COMMIT.
-    
+
     DAG job = context.getDAG();
-    Task task = 
+    Task task =
         job.getVertex(taskAttemptId.getTaskID().getVertexID()).
             getTask(taskAttemptId.getTaskID());
-    
+
     // TODO In-Memory Shuffle
     /*
     if (task.needsWaitAfterOutputConsumable()) {
@@ -503,7 +509,7 @@ public class TaskAttemptListenerImpTezDag extends AbstractService implements
     */
     return COMPLETION_RESPONSE_NO_WAIT;
   }
-  
+
 
   @Override
   public void unregisterTaskAttempt(TezTaskAttemptID attemptId) {
@@ -539,11 +545,11 @@ public class TaskAttemptListenerImpTezDag extends AbstractService implements
     }
     registeredContainers.remove(containerId);
   }
-  
+
   private void pingContainerHeartbeatHandler(ContainerId containerId) {
     containerHeartbeatHandler.pinged(containerId);
   }
-  
+
   private void pingContainerHeartbeatHandler(TezTaskAttemptID taskAttemptId) {
     ContainerId containerId = attemptToContainerIdMap.get(taskAttemptId);
     if (containerId != null) {

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java
index d2395ad..de43db0 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/DAGImpl.java
@@ -558,7 +558,9 @@ public class DAGImpl implements org.apache.tez.dag.app.dag.DAG,
   protected void startRootVertices() {
     for (Vertex v : vertices.values()) {
       if (v.getInputVerticesCount() == 0) {
-        LOG.info("DEBUG: Starting root vertex " + v.getName());
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("Starting root vertex " + v.getName());
+        }
         eventHandler.handle(new VertexEvent(v.getVertexId(),
             VertexEventType.V_START));
       }
@@ -577,12 +579,10 @@ public class DAGImpl implements org.apache.tez.dag.app.dag.DAG,
    * The only entry point to change the DAG.
    */
   public void handle(DAGEvent event) {
-    LOG.info("DEBUG: Processing DAGEvent " + event.getDAGId() + " of type "
-        + event.getType() + " while in state " + getInternalState()
-        + ". Event: " + event);
     if (LOG.isDebugEnabled()) {
       LOG.debug("Processing DAGEvent " + event.getDAGId() + " of type "
-          + event.getType() + " while in state " + getInternalState());
+          + event.getType() + " while in state " + getInternalState()
+          + ". Event: " + event);
     }
     try {
       writeLock.lock();
@@ -658,13 +658,14 @@ public class DAGImpl implements org.apache.tez.dag.app.dag.DAG,
   }
 
   static DAGState checkJobForCompletion(DAGImpl dag) {
-
-    LOG.info("ZZZZ: Checking dag completion"
-        + ", numCompletedVertices=" + dag.numCompletedVertices
-        + ", numSuccessfulVertices=" + dag.numSuccessfulVertices
-        + ", numFailedVertices=" + dag.numFailedVertices
-        + ", numKilledVertices=" + dag.numKilledVertices
-        + ", numVertices=" + dag.numVertices);
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Checking dag completion"
+          + ", numCompletedVertices=" + dag.numCompletedVertices
+          + ", numSuccessfulVertices=" + dag.numSuccessfulVertices
+          + ", numFailedVertices=" + dag.numFailedVertices
+          + ", numKilledVertices=" + dag.numKilledVertices
+          + ", numVertices=" + dag.numVertices);
+    }
 
     if (dag.numFailedVertices > 0) {
       dag.setFinishTime();
@@ -870,7 +871,7 @@ public class DAGImpl implements org.apache.tez.dag.app.dag.DAG,
         for (Vertex v : dag.vertices.values()) {
           parseVertexEdges(dag, edgePlans, v);
         }
-        
+
         assignDAGScheduler(dag);
 
         // TODO Metrics
@@ -887,7 +888,7 @@ public class DAGImpl implements org.apache.tez.dag.app.dag.DAG,
         return dag.finished(DAGState.FAILED);
       }
     }
-    
+
     private void assignDAGScheduler(DAGImpl dag) {
       boolean isMRR = true;
       for(Vertex vertex : dag.vertices.values()) {
@@ -895,15 +896,15 @@ public class DAGImpl implements org.apache.tez.dag.app.dag.DAG,
         if(outVertices == null || outVertices.isEmpty()) {
           continue;
         }
-        if(outVertices.size() > 1 || 
-           outVertices.values().iterator().next().getConnectionPattern() != 
+        if(outVertices.size() > 1 ||
+           outVertices.values().iterator().next().getConnectionPattern() !=
            EdgeProperty.ConnectionPattern.BIPARTITE) {
           // more than 1 output OR single output is not bipartite
           isMRR = false;
           break;
-        }          
+        }
       }
-      
+
       if(isMRR) {
         LOG.info("Using MRR dag scheduler");
         dag.dagScheduler = new DAGSchedulerMRR(dag, dag.eventHandler);
@@ -1110,10 +1111,11 @@ public class DAGImpl implements org.apache.tez.dag.app.dag.DAG,
     public DAGState transition(DAGImpl job, DAGEvent event) {
 
       DAGEventVertexCompleted vertexEvent = (DAGEventVertexCompleted) event;
-      LOG.info("DEBUG: Received a vertex completion event"
-          + ", vertexId=" + vertexEvent.getVertexId()
-          + ", vertexState=" + vertexEvent.getVertexState());
-
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("Received a vertex completion event"
+            + ", vertexId=" + vertexEvent.getVertexId()
+            + ", vertexState=" + vertexEvent.getVertexState());
+      }
       Vertex vertex = job.vertices.get(vertexEvent.getVertexId());
       job.numCompletedVertices++;
       if (vertexEvent.getVertexState() == VertexState.SUCCEEDED) {
@@ -1124,12 +1126,14 @@ public class DAGImpl implements org.apache.tez.dag.app.dag.DAG,
         vertexKilled(job, vertex);
       }
 
-      LOG.info("ZZZZ: Vertex completed."
-          + ", numCompletedVertices=" + job.numCompletedVertices
-          + ", numSuccessfulVertices=" + job.numSuccessfulVertices
-          + ", numFailedVertices=" + job.numFailedVertices
-          + ", numKilledVertices=" + job.numKilledVertices
-          + ", numVertices=" + job.numVertices);
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("Vertex completed."
+            + ", numCompletedVertices=" + job.numCompletedVertices
+            + ", numSuccessfulVertices=" + job.numSuccessfulVertices
+            + ", numFailedVertices=" + job.numFailedVertices
+            + ", numKilledVertices=" + job.numKilledVertices
+            + ", numVertices=" + job.numVertices);
+      }
 
       job.dagScheduler.vertexCompleted(vertex);
 

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskAttemptImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskAttemptImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskAttemptImpl.java
index c14ba8a..94e5161 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskAttemptImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskAttemptImpl.java
@@ -109,7 +109,7 @@ public class TaskAttemptImpl implements TaskAttempt,
   private static final Log LOG = LogFactory.getLog(TaskAttemptImpl.class);
   private static final String LINE_SEPARATOR = System
       .getProperty("line.separator");
-  
+
   static final TezCounters EMPTY_COUNTERS = new TezCounters();
 
   protected final TezConfiguration conf;
@@ -147,22 +147,22 @@ public class TaskAttemptImpl implements TaskAttempt,
   protected final boolean isRescheduled;
 
   protected String processorName;
-  
+
   protected static final FailedTransitionHelper FAILED_HELPER =
       new FailedTransitionHelper();
-      
+
   protected static final KilledTransitionHelper KILLED_HELPER =
       new KilledTransitionHelper();
 
   private static SingleArcTransition<TaskAttemptImpl, TaskAttemptEvent>
       DIAGNOSTIC_INFORMATION_UPDATE_TRANSITION =
           new DiagnosticInformationUpdater();
-  
+
   private static SingleArcTransition<TaskAttemptImpl, TaskAttemptEvent>
       STATUS_UPDATER = new StatusUpdaterTransition();
 
   private final StateMachine<TaskAttemptStateInternal, TaskAttemptEventType, TaskAttemptEvent> stateMachine;
-  
+
   private static StateMachineFactory
   <TaskAttemptImpl, TaskAttemptStateInternal, TaskAttemptEventType, TaskAttemptEvent>
   stateMachineFactory
@@ -174,7 +174,7 @@ public class TaskAttemptImpl implements TaskAttempt,
         .addTransition(TaskAttemptStateInternal.NEW, TaskAttemptStateInternal.NEW, TaskAttemptEventType.TA_DIAGNOSTICS_UPDATE, DIAGNOSTIC_INFORMATION_UPDATE_TRANSITION)
         .addTransition(TaskAttemptStateInternal.NEW, TaskAttemptStateInternal.FAILED, TaskAttemptEventType.TA_FAIL_REQUEST, new TerminateTransition(FAILED_HELPER))
         .addTransition(TaskAttemptStateInternal.NEW, TaskAttemptStateInternal.KILLED, TaskAttemptEventType.TA_KILL_REQUEST, new TerminateTransition(KILLED_HELPER))
-        
+
         .addTransition(TaskAttemptStateInternal.START_WAIT, TaskAttemptStateInternal.RUNNING, TaskAttemptEventType.TA_STARTED_REMOTELY, new StartedTransition())
         .addTransition(TaskAttemptStateInternal.START_WAIT, TaskAttemptStateInternal.START_WAIT, TaskAttemptEventType.TA_DIAGNOSTICS_UPDATE, DIAGNOSTIC_INFORMATION_UPDATE_TRANSITION)
         .addTransition(TaskAttemptStateInternal.START_WAIT, TaskAttemptStateInternal.FAIL_IN_PROGRESS, TaskAttemptEventType.TA_FAIL_REQUEST, new TerminatedBeforeRunningTransition(FAILED_HELPER))
@@ -182,7 +182,7 @@ public class TaskAttemptImpl implements TaskAttempt,
         .addTransition(TaskAttemptStateInternal.START_WAIT, TaskAttemptStateInternal.KILL_IN_PROGRESS, TaskAttemptEventType.TA_NODE_FAILED, new NodeFailedBeforeRunningTransition())
         .addTransition(TaskAttemptStateInternal.START_WAIT, TaskAttemptStateInternal.FAIL_IN_PROGRESS, TaskAttemptEventType.TA_CONTAINER_TERMINATING, new ContainerTerminatingBeforeRunningTransition())
         .addTransition(TaskAttemptStateInternal.START_WAIT, TaskAttemptStateInternal.FAILED, TaskAttemptEventType.TA_CONTAINER_TERMINATED, new ContainerCompletedBeforeRunningTransition())
-        
+
         .addTransition(TaskAttemptStateInternal.RUNNING, TaskAttemptStateInternal.RUNNING, TaskAttemptEventType.TA_STATUS_UPDATE, STATUS_UPDATER)
         .addTransition(TaskAttemptStateInternal.RUNNING, TaskAttemptStateInternal.RUNNING, TaskAttemptEventType.TA_DIAGNOSTICS_UPDATE, DIAGNOSTIC_INFORMATION_UPDATE_TRANSITION)
         .addTransition(TaskAttemptStateInternal.RUNNING, TaskAttemptStateInternal.OUTPUT_CONSUMABLE, TaskAttemptEventType.TA_OUTPUT_CONSUMABLE, new OutputConsumableTransition()) //Optional, may not come in for all tasks.
@@ -195,7 +195,7 @@ public class TaskAttemptImpl implements TaskAttempt,
         .addTransition(TaskAttemptStateInternal.RUNNING, TaskAttemptStateInternal.KILL_IN_PROGRESS, TaskAttemptEventType.TA_NODE_FAILED, new TerminatedWhileRunningTransition(KILLED_HELPER))
         .addTransition(TaskAttemptStateInternal.RUNNING, TaskAttemptStateInternal.FAIL_IN_PROGRESS, TaskAttemptEventType.TA_CONTAINER_TERMINATING, new TerminatedWhileRunningTransition(FAILED_HELPER))
         .addTransition(TaskAttemptStateInternal.RUNNING, TaskAttemptStateInternal.FAILED, TaskAttemptEventType.TA_CONTAINER_TERMINATED, new ContainerCompletedWhileRunningTransition())
-        
+
         .addTransition(TaskAttemptStateInternal.OUTPUT_CONSUMABLE, TaskAttemptStateInternal.OUTPUT_CONSUMABLE, TaskAttemptEventType.TA_STATUS_UPDATE, STATUS_UPDATER)
         .addTransition(TaskAttemptStateInternal.OUTPUT_CONSUMABLE, TaskAttemptStateInternal.OUTPUT_CONSUMABLE, TaskAttemptEventType.TA_DIAGNOSTICS_UPDATE, DIAGNOSTIC_INFORMATION_UPDATE_TRANSITION)
         .addTransition(TaskAttemptStateInternal.OUTPUT_CONSUMABLE, TaskAttemptStateInternal.OUTPUT_CONSUMABLE, TaskAttemptEventType.TA_OUTPUT_CONSUMABLE) // Stuck RPC. The client retries in a loop.
@@ -227,17 +227,17 @@ public class TaskAttemptImpl implements TaskAttempt,
         .addTransition(TaskAttemptStateInternal.KILL_IN_PROGRESS, TaskAttemptStateInternal.KILLED, TaskAttemptEventType.TA_CONTAINER_TERMINATED, new ContainerCompletedWhileTerminating())
         .addTransition(TaskAttemptStateInternal.KILL_IN_PROGRESS, TaskAttemptStateInternal.KILL_IN_PROGRESS, TaskAttemptEventType.TA_DIAGNOSTICS_UPDATE, DIAGNOSTIC_INFORMATION_UPDATE_TRANSITION)
         .addTransition(TaskAttemptStateInternal.KILL_IN_PROGRESS, TaskAttemptStateInternal.KILL_IN_PROGRESS, EnumSet.of(TaskAttemptEventType.TA_STARTED_REMOTELY, TaskAttemptEventType.TA_STATUS_UPDATE, TaskAttemptEventType.TA_OUTPUT_CONSUMABLE, TaskAttemptEventType.TA_COMMIT_PENDING, TaskAttemptEventType.TA_DONE, TaskAttemptEventType.TA_FAILED, TaskAttemptEventType.TA_TIMED_OUT, TaskAttemptEventType.TA_FAIL_REQUEST, TaskAttemptEventType.TA_KILL_REQUEST, TaskAttemptEventType.TA_NODE_FAILED, TaskAttemptEventType.TA_CONTAINER_TERMINATING, TaskAttemptEventType.TA_TOO_MANY_FETCH_FAILURES))
-        
+
         .addTransition(TaskAttemptStateInternal.FAIL_IN_PROGRESS, TaskAttemptStateInternal.FAILED, TaskAttemptEventType.TA_CONTAINER_TERMINATED, new ContainerCompletedWhileTerminating())
         .addTransition(TaskAttemptStateInternal.FAIL_IN_PROGRESS, TaskAttemptStateInternal.FAIL_IN_PROGRESS, TaskAttemptEventType.TA_DIAGNOSTICS_UPDATE, DIAGNOSTIC_INFORMATION_UPDATE_TRANSITION)
         .addTransition(TaskAttemptStateInternal.FAIL_IN_PROGRESS, TaskAttemptStateInternal.FAIL_IN_PROGRESS, EnumSet.of(TaskAttemptEventType.TA_STARTED_REMOTELY, TaskAttemptEventType.TA_STATUS_UPDATE, TaskAttemptEventType.TA_OUTPUT_CONSUMABLE, TaskAttemptEventType.TA_COMMIT_PENDING, TaskAttemptEventType.TA_DONE, TaskAttemptEventType.TA_FAILED, TaskAttemptEventType.TA_TIMED_OUT, TaskAttemptEventType.TA_FAIL_REQUEST, TaskAttemptEventType.TA_KILL_REQUEST, TaskAttemptEventType.TA_NODE_FAILED, TaskAttemptEventType.TA_CONTAINER_TERMINATING, TaskAttemptEventType.TA_TOO_MANY_FETCH_FAILURES))
-        
+
         .addTransition(TaskAttemptStateInternal.KILLED, TaskAttemptStateInternal.KILLED, TaskAttemptEventType.TA_DIAGNOSTICS_UPDATE, DIAGNOSTIC_INFORMATION_UPDATE_TRANSITION)
         .addTransition(TaskAttemptStateInternal.KILLED, TaskAttemptStateInternal.KILLED, EnumSet.of(TaskAttemptEventType.TA_STARTED_REMOTELY, TaskAttemptEventType.TA_STATUS_UPDATE, TaskAttemptEventType.TA_OUTPUT_CONSUMABLE, TaskAttemptEventType.TA_COMMIT_PENDING, TaskAttemptEventType.TA_DONE, TaskAttemptEventType.TA_FAILED, TaskAttemptEventType.TA_TIMED_OUT, TaskAttemptEventType.TA_FAIL_REQUEST, TaskAttemptEventType.TA_KILL_REQUEST, TaskAttemptEventType.TA_NODE_FAILED, TaskAttemptEventType.TA_CONTAINER_TERMINATING, TaskAttemptEventType.TA_CONTAINER_TERMINATED, TaskAttemptEventType.TA_TOO_MANY_FETCH_FAILURES))
 
         .addTransition(TaskAttemptStateInternal.FAILED, TaskAttemptStateInternal.FAILED, TaskAttemptEventType.TA_DIAGNOSTICS_UPDATE, DIAGNOSTIC_INFORMATION_UPDATE_TRANSITION)
         .addTransition(TaskAttemptStateInternal.FAILED, TaskAttemptStateInternal.FAILED, EnumSet.of(TaskAttemptEventType.TA_STARTED_REMOTELY, TaskAttemptEventType.TA_STATUS_UPDATE, TaskAttemptEventType.TA_OUTPUT_CONSUMABLE, TaskAttemptEventType.TA_COMMIT_PENDING, TaskAttemptEventType.TA_DONE, TaskAttemptEventType.TA_FAILED, TaskAttemptEventType.TA_TIMED_OUT, TaskAttemptEventType.TA_FAIL_REQUEST, TaskAttemptEventType.TA_KILL_REQUEST, TaskAttemptEventType.TA_NODE_FAILED, TaskAttemptEventType.TA_CONTAINER_TERMINATING, TaskAttemptEventType.TA_CONTAINER_TERMINATED, TaskAttemptEventType.TA_TOO_MANY_FETCH_FAILURES))
-        
+
         // How will duplicate history events be handled ?
         // TODO Maybe consider not failing REDUCE tasks in this case. Also, MAP_TASKS in case there's only one phase in the job.
         .addTransition(TaskAttemptStateInternal.SUCCEEDED, TaskAttemptStateInternal.SUCCEEDED, TaskAttemptEventType.TA_DIAGNOSTICS_UPDATE, DIAGNOSTIC_INFORMATION_UPDATE_TRANSITION)
@@ -245,21 +245,21 @@ public class TaskAttemptImpl implements TaskAttempt,
         .addTransition(TaskAttemptStateInternal.SUCCEEDED, TaskAttemptStateInternal.KILLED, TaskAttemptEventType.TA_NODE_FAILED, new TerminatedAfterSuccessTransition(KILLED_HELPER))
         .addTransition(TaskAttemptStateInternal.SUCCEEDED, TaskAttemptStateInternal.FAILED, TaskAttemptEventType.TA_TOO_MANY_FETCH_FAILURES, new TerminatedAfterSuccessTransition(FAILED_HELPER))
         .addTransition(TaskAttemptStateInternal.SUCCEEDED, TaskAttemptStateInternal.SUCCEEDED, EnumSet.of(TaskAttemptEventType.TA_TIMED_OUT, TaskAttemptEventType.TA_FAIL_REQUEST, TaskAttemptEventType.TA_CONTAINER_TERMINATING, TaskAttemptEventType.TA_CONTAINER_TERMINATED))
-        
-        
+
+
         .installTopology();
-  
+
 
   // TODO Remove TaskAttemptListener from the constructor.
   @SuppressWarnings("rawtypes")
   public TaskAttemptImpl(TezTaskID taskId, int attemptNumber, EventHandler eventHandler,
-      TaskAttemptListener tal, int partition, 
+      TaskAttemptListener tal, int partition,
       TezConfiguration conf,
       Token<JobTokenIdentifier> jobToken, Credentials credentials, Clock clock,
       TaskHeartbeatHandler taskHeartbeatHandler, AppContext appContext,
       String processorName, TaskLocationHint locationHint,
       Resource resource, Map<String, LocalResource> localResources,
-      Map<String, String> environment, 
+      Map<String, String> environment,
       String javaOpts, boolean isRescheduled) {
     ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock();
     this.readLock = rwLock.readLock();
@@ -286,34 +286,34 @@ public class TaskAttemptImpl implements TaskAttempt,
     this.javaOpts = javaOpts;
     this.isRescheduled = isRescheduled;
   }
-  
+
 
   @Override
   public TezTaskAttemptID getID() {
     return attemptId;
   }
-  
+
   @Override
   public TezVertexID getVertexID() {
     return attemptId.getTaskID().getVertexID();
   }
-  
+
   @Override
   public TezDAGID getDAGID() {
     return getVertexID().getDAGId();
   }
-  
+
   TezTaskContext createRemoteTask() {
     Vertex vertex = getTask().getVertex();
     DAG dag = vertex.getDAG();
 
     // TODO  TEZ-50 user and jobname
-    return new TezEngineTaskContext(getID(), dag.getUserName(), 
+    return new TezEngineTaskContext(getID(), dag.getUserName(),
         dag.getName(), getTask()
         .getVertex().getName(), processorName,
         vertex.getInputSpecList(), vertex.getOutputSpecList());
   }
-  
+
   @Override
   public TaskAttemptReport getReport() {
     TaskAttemptReport result = Records.newRecord(TaskAttemptReport.class);
@@ -322,7 +322,7 @@ public class TaskAttemptImpl implements TaskAttempt,
       result.setTaskAttemptId(attemptId);
       //take the LOCAL state of attempt
       //DO NOT take from reportedStatus
-      
+
       result.setTaskAttemptState(getState());
       result.setProgress(reportedStatus.progress);
       result.setStartTime(launchTime);
@@ -522,11 +522,9 @@ public class TaskAttemptImpl implements TaskAttempt,
   public void handle(TaskAttemptEvent event) {
     if (LOG.isDebugEnabled()) {
       LOG.debug("Processing TaskAttemptEvent " + event.getTaskAttemptID()
-          + " of type " + event.getType());
+          + " of type " + event.getType() + " while in state "
+          + getInternalState() + ". Event: " + event);
     }
-    LOG.info("DEBUG: Processing TaskAttemptEvent " + event.getTaskAttemptID()
-        + " of type " + event.getType() + " while in state "
-        + getInternalState() + ". Event: " + event);
     writeLock.lock();
     try {
       final TaskAttemptStateInternal oldState = getInternalState();
@@ -536,8 +534,8 @@ public class TaskAttemptImpl implements TaskAttempt,
         LOG.error("Can't handle this event at current state for "
             + this.attemptId, e);
         eventHandler.handle(new DAGEventDiagnosticsUpdate(
-            this.attemptId.getTaskID().getVertexID().getDAGId(), 
-            "Invalid event " + event.getType() + 
+            this.attemptId.getTaskID().getVertexID().getDAGId(),
+            "Invalid event " + event.getType() +
             " on TaskAttempt " + this.attemptId));
         eventHandler.handle(
             new DAGEvent(
@@ -546,7 +544,7 @@ public class TaskAttemptImpl implements TaskAttempt,
             );
       }
       if (oldState != getInternalState()) {
-          LOG.info(attemptId + " TaskAttempt Transitioned from " 
+          LOG.info(attemptId + " TaskAttempt Transitioned from "
            + oldState + " to "
            + getInternalState());
       }
@@ -554,7 +552,7 @@ public class TaskAttemptImpl implements TaskAttempt,
       writeLock.unlock();
     }
   }
-  
+
   @VisibleForTesting
   public TaskAttemptStateInternal getInternalState() {
     readLock.lock();
@@ -562,7 +560,7 @@ public class TaskAttemptImpl implements TaskAttempt,
       return stateMachine.getCurrentState();
     } finally {
       readLock.unlock();
-    }    
+    }
   }
 
   private static TaskAttemptState getExternalState(
@@ -590,7 +588,7 @@ public class TaskAttemptImpl implements TaskAttempt,
           + smState);
     }
   }
-  
+
   @Override
   public boolean getIsRescheduled() {
     return isRescheduled;
@@ -612,7 +610,7 @@ public class TaskAttemptImpl implements TaskAttempt,
   // TOOD Merge some of these JobCounter events.
   private static DAGEventCounterUpdate createJobCounterUpdateEventTALaunched(
       TaskAttemptImpl ta) {
-    DAGEventCounterUpdate jce = 
+    DAGEventCounterUpdate jce =
         new DAGEventCounterUpdate(
             ta.getDAGID()
             );
@@ -622,8 +620,8 @@ public class TaskAttemptImpl implements TaskAttempt,
 
   private static DAGEventCounterUpdate createJobCounterUpdateEventSlotMillis(
       TaskAttemptImpl ta) {
-    DAGEventCounterUpdate jce = 
-        new DAGEventCounterUpdate(            
+    DAGEventCounterUpdate jce =
+        new DAGEventCounterUpdate(
             ta.getDAGID()
             );
 
@@ -635,7 +633,7 @@ public class TaskAttemptImpl implements TaskAttempt,
   private static DAGEventCounterUpdate createJobCounterUpdateEventTATerminated(
       TaskAttemptImpl taskAttempt, boolean taskAlreadyCompleted,
       TaskAttemptStateInternal taState) {
-    DAGEventCounterUpdate jce = 
+    DAGEventCounterUpdate jce =
         new DAGEventCounterUpdate(
             taskAttempt.getDAGID());
 
@@ -687,16 +685,16 @@ public class TaskAttemptImpl implements TaskAttempt,
         taskAttempt.finishTime,
         taskAttempt.containerNodeId == null ? "UNKNOWN"
             : taskAttempt.containerNodeId.getHost(),
-        taskAttempt.containerNodeId == null ? -1 
-            : taskAttempt.containerNodeId.getPort(),    
-        taskAttempt.nodeRackName == null ? "UNKNOWN" 
+        taskAttempt.containerNodeId == null ? -1
+            : taskAttempt.containerNodeId.getPort(),
+        taskAttempt.nodeRackName == null ? "UNKNOWN"
             : taskAttempt.nodeRackName,
         StringUtils.join(
             LINE_SEPARATOR, taskAttempt.getDiagnostics()), taskAttempt
             .getProgressSplitBlock().burst());
     return tauce;
   }
-  
+
   // TODO Incorporate MAPREDUCE-4838
   private JobHistoryEvent createTaskAttemptStartedEvent() {
     TaskAttemptStartedEvent tase = new TaskAttemptStartedEvent(
@@ -707,7 +705,7 @@ public class TaskAttemptImpl implements TaskAttempt,
 
   }
   */
-  
+
 //  private WrappedProgressSplitsBlock getProgressSplitBlock() {
 //    return null;
 //    // TODO
@@ -725,7 +723,7 @@ public class TaskAttemptImpl implements TaskAttempt,
 //    }
 //    */
 //  }
-  
+
   private void updateProgressSplits() {
 //    double newProgress = reportedStatus.progress;
 //    newProgress = Math.max(Math.min(newProgress, 1.0D), 0.0D);
@@ -737,7 +735,7 @@ public class TaskAttemptImpl implements TaskAttempt,
 //    if (splitsBlock != null) {
 //      long now = clock.getTime();
 //      long start = getLaunchTime();
-//      
+//
 //      if (start == 0)
 //        return;
 //
@@ -767,7 +765,7 @@ public class TaskAttemptImpl implements TaskAttempt,
 //      }
 //    }
   }
-  
+
 //  private void maybeSendSpeculatorContainerRequired() {
 //    if (!speculatorContainerRequestSent) {
 //      sendEvent(new SpeculatorEvent(getID().getTaskID(), +1));
@@ -781,10 +779,10 @@ public class TaskAttemptImpl implements TaskAttempt,
 //      speculatorContainerRequestSent = false;
 //    }
 //  }
-  
+
   private void sendTaskAttemptCleanupEvent() {
-//    TaskAttemptContext taContext = 
-//        new TaskAttemptContextImpl(this.conf, 
+//    TaskAttemptContext taContext =
+//        new TaskAttemptContextImpl(this.conf,
 //            TezMRTypeConverter.fromTez(this.attemptId));
 //    sendEvent(new TaskCleanupEvent(this.attemptId, this.committer, taContext));
   }
@@ -825,7 +823,7 @@ public class TaskAttemptImpl implements TaskAttempt,
   protected void logJobHistoryAttemptFinishedEvent(TaskAttemptStateInternal state) {
     //Log finished events only if an attempt started.
     if (getLaunchTime() == 0) return;
-    
+
     TaskAttemptFinishedEvent finishEvt = new TaskAttemptFinishedEvent(
         attemptId, getTask().getVertex().getName(),
         getFinishTime(), TaskAttemptState.SUCCEEDED, "",
@@ -901,7 +899,7 @@ public class TaskAttemptImpl implements TaskAttempt,
               ta.localResources, remoteTaskContext, ta,
               ta.credentials, ta.jobToken, hostArray,
               rackArray,
-              scheduleEvent.getPriority(), ta.environment, //ta.javaOpts, 
+              scheduleEvent.getPriority(), ta.environment, //ta.javaOpts,
               ta.conf);
       ta.sendEvent(launchRequestEvent);
     }
@@ -1269,7 +1267,7 @@ public class TaskAttemptImpl implements TaskAttempt,
       return TaskEventType.T_ATTEMPT_KILLED;
     }
   }
-  
+
   @Override
   public String toString() {
     return getID().toString();
@@ -1284,10 +1282,10 @@ public class TaskAttemptImpl implements TaskAttempt,
   public Map<String, String> getEnvironment() {
     return this.environment;
   }
-  
+
   @Override
   public String getJavaOpts() {
-	return this.javaOpts;  
+	return this.javaOpts;
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java
index 575f32c..f295caf 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java
@@ -107,68 +107,68 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
   protected Resource taskResource;
   protected Map<String, LocalResource> localResources;
   protected Map<String, String> environment;
-  
+
   // counts the number of attempts that are either running or in a state where
   //  they will come to be running when they get a Container
   private int numberUncompletedAttempts = 0;
 
   private boolean historyTaskStartGenerated = false;
-  
-  private static final SingleArcTransition<TaskImpl, TaskEvent> 
+
+  private static final SingleArcTransition<TaskImpl, TaskEvent>
      ATTEMPT_KILLED_TRANSITION = new AttemptKilledTransition();
-  private static final SingleArcTransition<TaskImpl, TaskEvent> 
+  private static final SingleArcTransition<TaskImpl, TaskEvent>
      KILL_TRANSITION = new KillTransition();
 
   private static final StateMachineFactory
-               <TaskImpl, TaskStateInternal, TaskEventType, TaskEvent> 
-            stateMachineFactory 
+               <TaskImpl, TaskStateInternal, TaskEventType, TaskEvent>
+            stateMachineFactory
            = new StateMachineFactory<TaskImpl, TaskStateInternal, TaskEventType, TaskEvent>
                (TaskStateInternal.NEW)
 
     // define the state machine of Task
 
     // Transitions from NEW state
-    .addTransition(TaskStateInternal.NEW, TaskStateInternal.SCHEDULED, 
+    .addTransition(TaskStateInternal.NEW, TaskStateInternal.SCHEDULED,
         TaskEventType.T_SCHEDULE, new InitialScheduleTransition())
-    .addTransition(TaskStateInternal.NEW, TaskStateInternal.KILLED, 
+    .addTransition(TaskStateInternal.NEW, TaskStateInternal.KILLED,
         TaskEventType.T_KILL, new KillNewTransition())
 
     // Transitions from SCHEDULED state
       //when the first attempt is launched, the task state is set to RUNNING
-     .addTransition(TaskStateInternal.SCHEDULED, TaskStateInternal.RUNNING, 
+     .addTransition(TaskStateInternal.SCHEDULED, TaskStateInternal.RUNNING,
          TaskEventType.T_ATTEMPT_LAUNCHED, new LaunchTransition())
-     .addTransition(TaskStateInternal.SCHEDULED, TaskStateInternal.KILL_WAIT, 
+     .addTransition(TaskStateInternal.SCHEDULED, TaskStateInternal.KILL_WAIT,
          TaskEventType.T_KILL, KILL_TRANSITION)
-     .addTransition(TaskStateInternal.SCHEDULED, TaskStateInternal.SCHEDULED, 
+     .addTransition(TaskStateInternal.SCHEDULED, TaskStateInternal.SCHEDULED,
          TaskEventType.T_ATTEMPT_KILLED, ATTEMPT_KILLED_TRANSITION)
-     .addTransition(TaskStateInternal.SCHEDULED, 
-        EnumSet.of(TaskStateInternal.SCHEDULED, TaskStateInternal.FAILED), 
-        TaskEventType.T_ATTEMPT_FAILED, 
+     .addTransition(TaskStateInternal.SCHEDULED,
+        EnumSet.of(TaskStateInternal.SCHEDULED, TaskStateInternal.FAILED),
+        TaskEventType.T_ATTEMPT_FAILED,
         new AttemptFailedTransition())
- 
+
     // Transitions from RUNNING state
-    .addTransition(TaskStateInternal.RUNNING, TaskStateInternal.RUNNING, 
+    .addTransition(TaskStateInternal.RUNNING, TaskStateInternal.RUNNING,
         TaskEventType.T_ATTEMPT_LAUNCHED) //more attempts may start later
-    // This is an optional event. 
+    // This is an optional event.
     .addTransition(TaskStateInternal.RUNNING, TaskStateInternal.RUNNING,
         TaskEventType.T_ATTEMPT_OUTPUT_CONSUMABLE,
         new AttemptProcessingCompleteTransition())
-    .addTransition(TaskStateInternal.RUNNING, TaskStateInternal.RUNNING, 
+    .addTransition(TaskStateInternal.RUNNING, TaskStateInternal.RUNNING,
         TaskEventType.T_ATTEMPT_COMMIT_PENDING,
         new AttemptCommitPendingTransition())
     .addTransition(TaskStateInternal.RUNNING, TaskStateInternal.RUNNING,
         TaskEventType.T_ADD_SPEC_ATTEMPT, new RedundantScheduleTransition())
-    .addTransition(TaskStateInternal.RUNNING, TaskStateInternal.SUCCEEDED, 
+    .addTransition(TaskStateInternal.RUNNING, TaskStateInternal.SUCCEEDED,
         TaskEventType.T_ATTEMPT_SUCCEEDED,
         new AttemptSucceededTransition())
-    .addTransition(TaskStateInternal.RUNNING, TaskStateInternal.RUNNING, 
+    .addTransition(TaskStateInternal.RUNNING, TaskStateInternal.RUNNING,
         TaskEventType.T_ATTEMPT_KILLED,
         ATTEMPT_KILLED_TRANSITION)
-    .addTransition(TaskStateInternal.RUNNING, 
-        EnumSet.of(TaskStateInternal.RUNNING, TaskStateInternal.FAILED), 
+    .addTransition(TaskStateInternal.RUNNING,
+        EnumSet.of(TaskStateInternal.RUNNING, TaskStateInternal.FAILED),
         TaskEventType.T_ATTEMPT_FAILED,
         new AttemptFailedTransition())
-    .addTransition(TaskStateInternal.RUNNING, TaskStateInternal.KILL_WAIT, 
+    .addTransition(TaskStateInternal.RUNNING, TaskStateInternal.KILL_WAIT,
         TaskEventType.T_KILL, KILL_TRANSITION)
 
     // Transitions from KILL_WAIT state
@@ -203,7 +203,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
         EnumSet.of(TaskEventType.T_ADD_SPEC_ATTEMPT,
             TaskEventType.T_ATTEMPT_LAUNCHED))
 
-    // Transitions from FAILED state        
+    // Transitions from FAILED state
     .addTransition(TaskStateInternal.FAILED, TaskStateInternal.FAILED,
         EnumSet.of(TaskEventType.T_KILL,
                    TaskEventType.T_ADD_SPEC_ATTEMPT))
@@ -221,7 +221,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
 
   // TODO: Recovery
   /*
-  // By default, the next TaskAttempt number is zero. Changes during recovery  
+  // By default, the next TaskAttempt number is zero. Changes during recovery
   protected int nextAttemptNumber = 0;
   private List<TaskAttemptInfo> taskAttemptsFromPreviousGeneration =
       new ArrayList<TaskAttemptInfo>();
@@ -239,10 +239,10 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
       new RecoverdAttemptsComparator();
 
    */
-  
+
   private TezTaskAttemptID outputConsumableAttempt;
   private boolean outputConsumableAttemptSuccessSent = false;
-  
+
   //should be set to one which comes first
   //saying COMMIT_PENDING
   private TezTaskAttemptID commitAttempt;
@@ -272,10 +272,10 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
       Token<JobTokenIdentifier> jobToken,
       Credentials credentials, Clock clock,
       // TODO Recovery
-      //Map<TezTaskID, TaskInfo> completedTasksFromPreviousRun, 
+      //Map<TezTaskID, TaskInfo> completedTasksFromPreviousRun,
       //int startCount,
       // TODO Metrics
-      //MRAppMetrics metrics, 
+      //MRAppMetrics metrics,
       TaskHeartbeatHandler thh, AppContext appContext,
       String processorName,
       boolean leafVertex, TaskLocationHint locationHint, Resource resource,
@@ -289,7 +289,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
     writeLock = readWriteLock.writeLock();
     this.attempts = Collections.emptyMap();
     // TODO TEZ-47 get from conf or API
-    maxAttempts = this.conf.getInt(TezConfiguration.DAG_MAX_TASK_ATTEMPTS, 
+    maxAttempts = this.conf.getInt(TezConfiguration.DAG_MAX_TASK_ATTEMPTS,
                               TezConfiguration.DAG_MAX_TASK_ATTEMPTS_DEFAULT);
     taskId = new TezTaskID(vertexId, partition);
     this.partition = partition;
@@ -360,7 +360,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
       if (attempts.size() <= 1) {
         return attempts;
       }
-      
+
       Map<TezTaskAttemptID, TaskAttempt> result
           = new LinkedHashMap<TezTaskAttemptID, TaskAttempt>();
       result.putAll(attempts);
@@ -385,7 +385,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
   public Vertex getVertex() {
     return appContext.getDAG().getVertex(taskId.getVertexID());
   }
-  
+
   @Override
   public TezTaskID getTaskId() {
     return taskId;
@@ -424,12 +424,12 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
       }
 
       report.setSuccessfulAttempt(successfulAttempt);
-      
+
       for (TaskAttempt att : attempts.values()) {
         String prefix = "AttemptID:" + att.getID() + " Info:";
         for (CharSequence cs : att.getDiagnostics()) {
           report.addDiagnostics(prefix + cs);
-          
+
         }
       }
 
@@ -482,7 +482,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
       return stateMachine.getCurrentState();
     } finally {
       readLock.unlock();
-    }    
+    }
   }
 
   private static TaskState getExternalState(TaskStateInternal smState) {
@@ -490,7 +490,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
       return TaskState.KILLED;
     } else {
       return TaskState.valueOf(smState.name());
-    }    
+    }
   }
 
   //this is always called in read/write lock
@@ -530,7 +530,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
     }
     return finishTime;
   }
-  
+
   private TaskStateInternal finished(TaskStateInternal finalState) {
     if (getInternalState() == TaskStateInternal.RUNNING) {
       // TODO Metrics
@@ -552,7 +552,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
       case KILLED:
         continue;
       default:
-      }      
+      }
       if (result == null) {
         result = at; //The first time around
       }
@@ -589,8 +589,8 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
       return false;
     }
   }
-  
-  
+
+
   @Override
   public TezTaskAttemptID getOutputConsumableAttempt() {
     readLock.lock();
@@ -608,7 +608,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
         appContext, processorName, locationHint, taskResource,
         localResources, environment, javaOpts, (failedAttempts>0));
   }
-  
+
   protected TaskAttempt getSuccessfulAttempt() {
     readLock.lock();
     try {
@@ -631,7 +631,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
       case 0:
         attempts = Collections.singletonMap(attempt.getID(), attempt);
         break;
-        
+
       case 1:
         Map<TezTaskAttemptID, TaskAttempt> newAttempts
             = new LinkedHashMap<TezTaskAttemptID, TaskAttempt>(maxAttempts);
@@ -663,17 +663,15 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
     // picture in mind
     eventHandler.handle(new DAGEventSchedulerUpdate(
         DAGEventSchedulerUpdate.UpdateType.TA_SCHEDULE, attempt));
-    
+
   }
 
   @Override
   public void handle(TaskEvent event) {
-    LOG.info("DEBUG: Processing TaskEvent " + event.getTaskID() + " of type "
-        + event.getType() + " while in state " + getInternalState()
-        + ". Event: " + event);
     if (LOG.isDebugEnabled()) {
       LOG.debug("Processing TaskEvent " + event.getTaskID() + " of type "
-          + event.getType());
+          + event.getType() + " while in state " + getInternalState()
+          + ". Event: " + event);
     }
     try {
       writeLock.lock();
@@ -698,7 +696,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
   protected void internalError(TaskEventType type) {
     LOG.error("Invalid event " + type + " on Task " + this.taskId);
     eventHandler.handle(new DAGEventDiagnosticsUpdate(
-        this.taskId.getVertexID().getDAGId(), "Invalid event " + type + 
+        this.taskId.getVertexID().getDAGId(), "Invalid event " + type +
         " on Task " + this.taskId));
     eventHandler.handle(new DAGEvent(this.taskId.getVertexID().getDAGId(),
         DAGEventType.INTERNAL_ERROR));
@@ -719,19 +717,19 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
         }
       }
     }
-    if (attempt.getNodeHttpAddress() != null) {      
-      
+    if (attempt.getNodeHttpAddress() != null) {
+
       String scheme = (encryptedShuffle) ? "https://" : "http://";
       String url = scheme
           + attempt.getNodeHttpAddress().split(":")[0] + ":"
           + attempt.getShufflePort();
-      
-      
-      
+
+
+
       int runTime = 0;
       if (attempt.getFinishTime() != 0 && attempt.getLaunchTime() != 0)
         runTime = (int) (attempt.getFinishTime() - attempt.getLaunchTime());
-      
+
       TezDependentTaskCompletionEvent tce = new TezDependentTaskCompletionEvent(
           -1, attemptId, status, url, runTime);
 
@@ -740,7 +738,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
       eventHandler.handle(new VertexEventTaskAttemptCompleted(tce));
     }
   }
-  
+
   // always called inside a transition, in turn inside the Write Lock
   private void handleTaskAttemptCompletion(TezTaskAttemptID attemptId,
       TezDependentTaskCompletionEvent.Status status) {
@@ -759,7 +757,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
         task.getCounters());
     return tfe;
   }
-  
+
   private static TaskFailedEvent createTaskFailedEvent(TaskImpl task, List<String> diag, TaskStateInternal taskState, TezTaskAttemptID taId) {
     StringBuilder errorSb = new StringBuilder();
     if (diag != null) {
@@ -778,7 +776,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
     return taskFailedEvent;
   }
   */
-  
+
   private static void unSucceed(TaskImpl task) {
     task.commitAttempt = null;
     task.successfulAttempt = null;
@@ -801,7 +799,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
     this.eventHandler.handle(new DAGHistoryEvent(
         taskId.getVertexID().getDAGId(), startEvt));
   }
-  
+
   protected void logJobHistoryTaskFinishedEvent() {
     // FIXME need to handle getting finish time as this function
     // is called from within a transition
@@ -811,7 +809,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
     this.eventHandler.handle(new DAGHistoryEvent(
         taskId.getVertexID().getDAGId(), finishEvt));
   }
-  
+
   protected void logJobHistoryTaskFailedEvent(TaskState finalState) {
     TaskFinishedEvent finishEvt = new TaskFinishedEvent(taskId,
         getVertex().getName(), clock.getTime(), finalState, getCounters());
@@ -859,15 +857,19 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
             TezDependentTaskCompletionEvent.Status.SUCCEEDED);
         task.outputConsumableAttempt = attemptId;
         task.outputConsumableAttemptSuccessSent = true;
-        LOG.info("DEBUG: TezTaskAttemptID: " + attemptId
-            + " set as the OUTPUT_READY attempt");
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("TezTaskAttemptID: " + attemptId
+              + " set as the OUTPUT_READY attempt");
+        }
       } else {
         // Nothing to do. This task will eventually be told to die, or will be
         // killed.
-        LOG.info("DEBUG: TezTaskAttemptID: "
-            + attemptId
-            + " reporting OUTPUT_READY. Will be asked to die since another attempt "
-            + task.outputConsumableAttempt + " already has output ready");
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("TezTaskAttemptID: "
+              + attemptId + " reporting OUTPUT_READY."
+              + " Will be asked to die since another attempt "
+              + task.outputConsumableAttempt + " already has output ready");
+        }
         task.eventHandler.handle(new TaskAttemptEventKillRequest(attemptId,
             "Alternate attemptId already serving output"));
       }
@@ -899,12 +901,12 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
     }
   }
 
-  private static class AttemptSucceededTransition 
+  private static class AttemptSucceededTransition
       implements SingleArcTransition<TaskImpl, TaskEvent> {
     @Override
     public void transition(TaskImpl task, TaskEvent event) {
       task.handleTaskAttemptCompletion(
-          ((TaskEventTAUpdate) event).getTaskAttemptID(), 
+          ((TaskEventTAUpdate) event).getTaskAttemptID(),
           TezDependentTaskCompletionEvent.Status.SUCCEEDED);
       task.finishedAttempts++;
       --task.numberUncompletedAttempts;
@@ -937,7 +939,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
     @Override
     public void transition(TaskImpl task, TaskEvent event) {
       task.handleTaskAttemptCompletion(
-          ((TaskEventTAUpdate) event).getTaskAttemptID(), 
+          ((TaskEventTAUpdate) event).getTaskAttemptID(),
           TezDependentTaskCompletionEvent.Status.KILLED);
       task.finishedAttempts++;
       --task.numberUncompletedAttempts;
@@ -956,7 +958,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
     @Override
     public TaskStateInternal transition(TaskImpl task, TaskEvent event) {
       task.handleTaskAttemptCompletion(
-          ((TaskEventTAUpdate) event).getTaskAttemptID(), 
+          ((TaskEventTAUpdate) event).getTaskAttemptID(),
           TezDependentTaskCompletionEvent.Status.KILLED);
       task.finishedAttempts++;
       // check whether all attempts are finished
@@ -997,7 +999,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
       task.finishedAttempts++;
       if (task.failedAttempts < task.maxAttempts) {
         task.handleTaskAttemptCompletion(
-            ((TaskEventTAUpdate) event).getTaskAttemptID(), 
+            ((TaskEventTAUpdate) event).getTaskAttemptID(),
             TezDependentTaskCompletionEvent.Status.FAILED);
         // we don't need a new event if we already have a spare
         if (--task.numberUncompletedAttempts == 0
@@ -1006,9 +1008,9 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
         }
       } else {
         task.handleTaskAttemptCompletion(
-            ((TaskEventTAUpdate) event).getTaskAttemptID(), 
+            ((TaskEventTAUpdate) event).getTaskAttemptID(),
             TezDependentTaskCompletionEvent.Status.TIPFAILED);
-        
+
         if (task.historyTaskStartGenerated) {
           task.logJobHistoryTaskFailedEvent(TaskState.FAILED);
         } else {
@@ -1046,7 +1048,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
         LOG.error("Unexpected event for task of leaf vertex " + event.getType());
         task.internalError(event.getType());
       }
-      
+
       // tell the job about the rescheduling
       task.eventHandler.handle(
           new VertexEventTaskReschedule(task.taskId));
@@ -1085,16 +1087,16 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
         // tell the job about the rescheduling
         unSucceed(task);
         task.handleTaskAttemptCompletion(
-            attemptId, 
+            attemptId,
             TezDependentTaskCompletionEvent.Status.KILLED);
         task.eventHandler.handle(new VertexEventTaskReschedule(task.taskId));
-        // typically we are here because this map task was run on a bad node and 
+        // typically we are here because this map task was run on a bad node and
         // we want to reschedule it on a different node.
-        // Depending on whether there are previous failed attempts or not this 
+        // Depending on whether there are previous failed attempts or not this
         // can SCHEDULE or RESCHEDULE the container allocate request. If this
         // SCHEDULE's then the dataLocal hosts of this taskAttempt will be used
-        // from the map splitInfo. So the bad node might be sent as a location 
-        // to the RM. But the RM would ignore that just like it would ignore 
+        // from the map splitInfo. So the bad node might be sent as a location
+        // to the RM. But the RM would ignore that just like it would ignore
         // currently pending container requests affinitized to bad nodes.
         task.addAndScheduleAttempt();
         return TaskStateInternal.SCHEDULED;
@@ -1105,11 +1107,11 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
     }
   }
 
-  private static class KillNewTransition 
+  private static class KillNewTransition
     implements SingleArcTransition<TaskImpl, TaskEvent> {
     @Override
     public void transition(TaskImpl task, TaskEvent event) {
-      
+
       if (task.historyTaskStartGenerated) {
         task.logJobHistoryTaskFailedEvent(TaskState.KILLED);
       } else {
@@ -1131,7 +1133,7 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
     }
   }
 
-  private static class KillTransition 
+  private static class KillTransition
     implements SingleArcTransition<TaskImpl, TaskEvent> {
     @Override
     public void transition(TaskImpl task, TaskEvent event) {

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
index b06e264..c8ee314 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
@@ -599,12 +599,10 @@ public class VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
    * The only entry point to change the Vertex.
    */
   public void handle(VertexEvent event) {
-    LOG.info("DEBUG: Processing VertexEvent " + event.getVertexId()
-        + " of type " + event.getType() + " while in state "
-        + getInternalState() + ". Event: " + event);
     if (LOG.isDebugEnabled()) {
-      LOG.debug("Processing VertexEvent " + event.getVertexId() + " of type "
-          + event.getType() + " while in state " + getInternalState());
+      LOG.debug("Processing VertexEvent " + event.getVertexId()
+          + " of type " + event.getType() + " while in state "
+          + getInternalState() + ". Event: " + event);
     }
     try {
       writeLock.lock();
@@ -631,9 +629,6 @@ public class VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
     finally {
       writeLock.unlock();
     }
-    LOG.info("DEBUG: Finished processing VertexEvent " + event.getVertexId()
-        + " of type " + event.getType() + " while in state "
-        + getInternalState() + ". Event: " + event);
   }
 
   private VertexState getInternalState() {
@@ -699,12 +694,13 @@ public class VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
 
   static VertexState checkVertexForCompletion(VertexImpl vertex) {
     //check for vertex failure first
-
-    LOG.info("ZZZZ: checking for vertex completion"
-        + ", failedTaskCount=" + vertex.failedTaskCount
-        + ", killedTaskCount=" + vertex.killedTaskCount
-        + ", successfulTaskCount=" + vertex.succeededTaskCount
-        + ", completedTaskCount=" + vertex.completedTaskCount);
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Checking for vertex completion"
+          + ", failedTaskCount=" + vertex.failedTaskCount
+          + ", killedTaskCount=" + vertex.killedTaskCount
+          + ", successfulTaskCount=" + vertex.succeededTaskCount
+          + ", completedTaskCount=" + vertex.completedTaskCount);
+    }
 
     if (vertex.failedTaskCount > 0) {
       vertex.setFinishTime();
@@ -1287,8 +1283,10 @@ public class VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
       InputSpec inputSpec = new InputSpec(entry.getKey().getName(),
           entry.getKey().getTotalTasks(),
           entry.getValue().getInputClass());
-      LOG.info("DEBUG: For vertex : " + this.getName()
-          + ", Using InputSpec : " + inputSpec);
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("For vertex : " + this.getName()
+            + ", Using InputSpec : " + inputSpec);
+      }
       // TODO DAGAM This should be based on the edge type.
       inputSpecList.add(inputSpec);
     }
@@ -1304,8 +1302,10 @@ public class VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
         OutputSpec outputSpec = new OutputSpec(entry.getKey().getName(),
             entry.getKey().getTotalTasks(),
             entry.getValue().getOutputClass());
-        LOG.info("DEBUG: For vertex : " + this.getName()
-            + ", Using OutputSpec : " + outputSpec);
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("For vertex : " + this.getName()
+              + ", Using OutputSpec : " + outputSpec);
+        }
         // TODO DAGAM This should be based on the edge type.
         outputSpecList.add(outputSpec);
       }

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/9feab053/tez-dag/src/main/java/org/apache/tez/dag/app/rm/container/AMContainerImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/rm/container/AMContainerImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/rm/container/AMContainerImpl.java
index 58e9d50..bab02da 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/rm/container/AMContainerImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/rm/container/AMContainerImpl.java
@@ -59,7 +59,7 @@ import org.apache.tez.dag.records.TezTaskAttemptID;
 public class AMContainerImpl implements AMContainer {
 
   private static final Log LOG = LogFactory.getLog(AMContainerImpl.class);
-  
+
   private final ReadLock readLock;
   private final WriteLock writeLock;
   private final ContainerId containerId;
@@ -75,10 +75,10 @@ public class AMContainerImpl implements AMContainer {
   // TODO Maybe this should be pulled from the TaskAttempt.s
   private final Map<TezTaskAttemptID, TezTaskContext> remoteTaskMap =
       new HashMap<TezTaskAttemptID, TezTaskContext>();
-  
+
   // TODO ?? Convert to list and hash.
-  
-  private int shufflePort; 
+
+  private int shufflePort;
   private long idleTimeBetweenTasks = 0;
   private long lastTaskFinishTime;
 
@@ -92,16 +92,16 @@ public class AMContainerImpl implements AMContainer {
   private TezTaskAttemptID runningAttempt;
   private List<TezTaskAttemptID> failedAssignments;
   private TezTaskAttemptID pullAttempt;
-  
+
   private AMContainerTask noAllocationContainerTask;
-  
+
   private static final AMContainerTask NO_MORE_TASKS = new AMContainerTask(
       true, null);
   private static final AMContainerTask WAIT_TASK = new AMContainerTask(false,
       null);
-  
+
   private boolean inError = false;
-  
+
   private ContainerLaunchContext clc;
 
   // TODO Consider registering with the TAL, instead of the TAL pulling.
@@ -115,8 +115,8 @@ public class AMContainerImpl implements AMContainer {
 
   private final StateMachine<AMContainerState, AMContainerEventType, AMContainerEvent> stateMachine;
   private static final StateMachineFactory
-      <AMContainerImpl, AMContainerState, AMContainerEventType, AMContainerEvent> 
-      stateMachineFactory = 
+      <AMContainerImpl, AMContainerState, AMContainerEventType, AMContainerEvent>
+      stateMachineFactory =
       new StateMachineFactory<AMContainerImpl, AMContainerState, AMContainerEventType, AMContainerEvent>(
       AMContainerState.ALLOCATED)
 
@@ -144,7 +144,7 @@ public class AMContainerImpl implements AMContainer {
         .addTransition(AMContainerState.IDLE, AMContainerState.STOP_REQUESTED, AMContainerEventType.C_TIMED_OUT, new TimedOutAtIdleTransition())
         .addTransition(AMContainerState.IDLE, AMContainerState.STOPPING, AMContainerEventType.C_NODE_FAILED, new NodeFailedAtIdleTransition())
         .addTransition(AMContainerState.IDLE, AMContainerState.STOP_REQUESTED, EnumSet.of(AMContainerEventType.C_LAUNCH_REQUEST, AMContainerEventType.C_LAUNCHED, AMContainerEventType.C_LAUNCH_FAILED, AMContainerEventType.C_TA_SUCCEEDED, AMContainerEventType.C_NM_STOP_SENT, AMContainerEventType.C_NM_STOP_FAILED), new ErrorAtIdleTransition())
-        
+
         .addTransition(AMContainerState.RUNNING, AMContainerState.STOP_REQUESTED, AMContainerEventType.C_ASSIGN_TA, new AssignTaskAttemptAtRunningTransition())
         .addTransition(AMContainerState.RUNNING, AMContainerState.RUNNING, AMContainerEventType.C_PULL_TA)
         .addTransition(AMContainerState.RUNNING, AMContainerState.IDLE, AMContainerEventType.C_TA_SUCCEEDED, new TASucceededAtRunningTransition())
@@ -162,7 +162,7 @@ public class AMContainerImpl implements AMContainer {
         .addTransition(AMContainerState.STOP_REQUESTED, AMContainerState.STOPPING, AMContainerEventType.C_NODE_FAILED, new NodeFailedAtNMStopRequestedTransition())
         .addTransition(AMContainerState.STOP_REQUESTED, AMContainerState.STOP_REQUESTED, EnumSet.of(AMContainerEventType.C_LAUNCHED, AMContainerEventType.C_LAUNCH_FAILED, AMContainerEventType.C_TA_SUCCEEDED, AMContainerEventType.C_STOP_REQUEST, AMContainerEventType.C_TIMED_OUT))
         .addTransition(AMContainerState.STOP_REQUESTED, AMContainerState.STOP_REQUESTED, AMContainerEventType.C_LAUNCH_REQUEST, new ErrorAtNMStopRequestedTransition())
-        
+
         .addTransition(AMContainerState.STOPPING, AMContainerState.STOPPING, AMContainerEventType.C_ASSIGN_TA, new AssignTAAtWindDownTransition())
         .addTransition(AMContainerState.STOPPING, AMContainerState.STOPPING, AMContainerEventType.C_PULL_TA, new PullTAAfterStopTransition())
         // TODO This transition is wrong. Should be a noop / error.
@@ -196,10 +196,10 @@ public class AMContainerImpl implements AMContainer {
     this.taskAttemptListener = tal;
     this.failedAssignments = new LinkedList<TezTaskAttemptID>();
 
-    this.noAllocationContainerTask = WAIT_TASK; 
+    this.noAllocationContainerTask = WAIT_TASK;
     this.stateMachine = stateMachineFactory.make(this);
   }
-  
+
   @Override
   public AMContainerState getState() {
     readLock.lock();
@@ -214,7 +214,7 @@ public class AMContainerImpl implements AMContainer {
   public ContainerId getContainerId() {
     return this.containerId;
   }
-  
+
   @Override
   public Container getContainer() {
     return this.container;
@@ -262,7 +262,7 @@ public class AMContainerImpl implements AMContainer {
       readLock.unlock();
     }
   }
-  
+
   @Override
   public int getShufflePort() {
     readLock.lock();
@@ -272,17 +272,19 @@ public class AMContainerImpl implements AMContainer {
       readLock.unlock();
     }
   }
-  
+
   public boolean isInErrorState() {
     return inError;
   }
 
   @Override
   public void handle(AMContainerEvent event) {
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Processing AMContainerEvent " + event.getContainerId()
+          + " of type " + event.getType() + " while in state: " + getState()
+          + ". Event: " + event);
+    }
     this.writeLock.lock();
-    LOG.info("DEBUG: Processing AMContainerEvent " + event.getContainerId()
-        + " of type " + event.getType() + " while in state: " + getState()
-        + ". Event: " + event);
     try {
       final AMContainerState oldState = getState();
       try {
@@ -302,7 +304,7 @@ public class AMContainerImpl implements AMContainer {
       writeLock.unlock();
     }
   }
-  
+
   @SuppressWarnings("unchecked")
   private void sendEvent(Event<?> event) {
     this.eventHandler.handle(event);
@@ -348,14 +350,14 @@ public class AMContainerImpl implements AMContainer {
           container.taskAttemptListener, event.getCredentials(),
           event.shouldProfile(), container.appContext);
 
-      // Registering now, so that in case of delayed NM response, the child 
+      // Registering now, so that in case of delayed NM response, the child
       // task is not told to die since the TAL does not know about the container.
       container.registerWithTAListener();
       container.sendStartRequestToNM();
       LOG.info("Sending Launch Request for Container with id: " +
           container.container.getId());
       // Forget about the clc to save resources. At some point, part of the clc
-      // info may need to be exposed to the scheduler to figure out whether a 
+      // info may need to be exposed to the scheduler to figure out whether a
       // container can be used for a specific TaskAttempt.
       container.clc = null;
     }
@@ -451,7 +453,9 @@ public class AMContainerImpl implements AMContainer {
         return AMContainerState.STOP_REQUESTED;
       }
       container.pendingAttempt = event.getTaskAttemptId();
-      LOG.info("DEBUG: AssignTA: attempt: " + event.getRemoteTaskContext());
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("AssignTA: attempt: " + event.getRemoteTaskContext());
+      }
       container.remoteTaskMap
           .put(event.getTaskAttemptId(), event.getRemoteTaskContext());
       return container.getState();
@@ -580,7 +584,7 @@ public class AMContainerImpl implements AMContainer {
     public void transition(AMContainerImpl container, AMContainerEvent cEvent) {
       super.transition(container, cEvent);
       if (container.pendingAttempt != null) {
-        container.sendTerminatingToTaskAttempt(container.pendingAttempt, 
+        container.sendTerminatingToTaskAttempt(container.pendingAttempt,
             "Container " + container.getContainerId() +
                 " hit an invalid transition - " + cEvent.getType() + " at " +
                 container.getState());
@@ -595,8 +599,10 @@ public class AMContainerImpl implements AMContainer {
     @Override
     public AMContainerState transition(
         AMContainerImpl container, AMContainerEvent cEvent) {
-      LOG.info("DEBUG: AssignTAAtIdle: attempt: " +
-          ((AMContainerEventAssignTA) cEvent).getRemoteTaskContext());
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("AssignTAAtIdle: attempt: " +
+            ((AMContainerEventAssignTA) cEvent).getRemoteTaskContext());
+      }
       return super.transition(container, cEvent);
     }
   }
@@ -617,12 +623,13 @@ public class AMContainerImpl implements AMContainer {
         if (container.lastTaskFinishTime != 0) {
           long idleTimeDiff =
               System.currentTimeMillis() - container.lastTaskFinishTime;
-          LOG.info("DEBUG: Computing idle time for container: " +
-              container.getContainerId() + ", lastFinishTime: " +
-              container.lastTaskFinishTime + ", Incremented by: " +
-              idleTimeDiff);
-          container.idleTimeBetweenTasks +=
-              System.currentTimeMillis() - container.lastTaskFinishTime;
+          container.idleTimeBetweenTasks += idleTimeDiff;
+          if (LOG.isDebugEnabled()) {
+            LOG.debug("Computing idle time for container: " +
+                container.getContainerId() + ", lastFinishTime: " +
+                container.lastTaskFinishTime + ", Incremented by: " +
+                idleTimeDiff);
+          }
         }
         LOG.info("Assigned taskAttempt + [" + container.runningAttempt +
             "] to container: [" + container.getContainerId() + "]");
@@ -656,7 +663,9 @@ public class AMContainerImpl implements AMContainer {
     @Override
     public void transition(AMContainerImpl container, AMContainerEvent cEvent) {
       super.transition(container, cEvent);
-      LOG.info("DEBUG: IdleTimeBetweenTasks: " + container.idleTimeBetweenTasks);
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("IdleTimeBetweenTasks: " + container.idleTimeBetweenTasks);
+      }
       container.unregisterFromContainerListener();
     }
   }
@@ -785,7 +794,7 @@ public class AMContainerImpl implements AMContainer {
       container.registerFailedAttempt(event.getTaskAttemptId());
     }
   }
-  
+
   // Hack to some extent. This allocation should be done while entering one of
   // the post-running states, insetad of being a transition on the post stop
   // states.
@@ -907,11 +916,11 @@ public class AMContainerImpl implements AMContainer {
   protected void registerFailedAttempt(TezTaskAttemptID taId) {
     failedAssignments.add(taId);
   }
-  
+
   protected void deAllocate() {
     sendEvent(new AMSchedulerEventDeallocateContainer(containerId));
   }
-  
+
   protected void sendCompletedToScheduler() {
     sendEvent(new AMSchedulerEventContainerCompleted(containerId));
   }
@@ -944,7 +953,7 @@ public class AMContainerImpl implements AMContainer {
     sendEvent(new NMCommunicatorStopRequestEvent(containerId,
         container.getNodeId(), container.getContainerToken()));
   }
-  
+
   protected void unregisterAttemptFromListener(TezTaskAttemptID attemptId) {
     taskAttemptListener.unregisterTaskAttempt(attemptId);
   }
@@ -965,7 +974,7 @@ public class AMContainerImpl implements AMContainer {
   protected void unregisterFromContainerListener() {
     this.containerHeartbeatHandler.unregister(this.containerId);
   }
-  
 
-  
+
+
 }