tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gunt...@apache.org
Subject git commit: TEZ-807. Build broken due to NPE (Patch by Gunther Hagleitner, reviewed by Siddharth Seth)
Date Fri, 07 Feb 2014 00:38:10 GMT
Updated Branches:
  refs/heads/master 6480f1bda -> 0320cd7ac


TEZ-807. Build broken due to NPE (Patch by Gunther Hagleitner, reviewed by Siddharth Seth)


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

Branch: refs/heads/master
Commit: 0320cd7acef31d2518fe09f0d8ede4eca259537f
Parents: 6480f1b
Author: Gunther Hagleitner <gunther@apache.org>
Authored: Thu Feb 6 15:36:27 2014 -0800
Committer: Gunther Hagleitner <gunther@apache.org>
Committed: Thu Feb 6 16:25:46 2014 -0800

----------------------------------------------------------------------
 .../org/apache/tez/client/TezClientUtils.java   |  6 ---
 .../java/org/apache/tez/client/TezSession.java  |  4 --
 .../main/java/org/apache/tez/dag/api/DAG.java   | 54 +++++++++-----------
 .../java/org/apache/tez/dag/api/Vertex.java     | 18 +++++--
 4 files changed, 39 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/0320cd7a/tez-api/src/main/java/org/apache/tez/client/TezClientUtils.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/client/TezClientUtils.java b/tez-api/src/main/java/org/apache/tez/client/TezClientUtils.java
index 09c025a..82cb0c7 100644
--- a/tez-api/src/main/java/org/apache/tez/client/TezClientUtils.java
+++ b/tez-api/src/main/java/org/apache/tez/client/TezClientUtils.java
@@ -477,18 +477,12 @@ public class TezClientUtils {
     if(dag != null) {
 
       for (Vertex v : dag.getVertices()) {
-        if (v.getTaskLocalResources() == null) {
-          v.setTaskLocalResources(new TreeMap<String, LocalResource>());
-        }
         if (tezJarResources != null) {
           v.getTaskLocalResources().putAll(tezJarResources);
         }
         v.getTaskLocalResources().put(TezConfiguration.TEZ_PB_BINARY_CONF_NAME,
             binaryConfLRsrc);
 
-        if (v.getTaskEnvironment() == null) {
-          v.setTaskEnvironment(new TreeMap<String, String>());
-        }
         Map<String, String> taskEnv = v.getTaskEnvironment();
         for (Map.Entry<String, String> entry : environment.entrySet()) {
           String key = entry.getKey();

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/0320cd7a/tez-api/src/main/java/org/apache/tez/client/TezSession.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/client/TezSession.java b/tez-api/src/main/java/org/apache/tez/client/TezSession.java
index 62546e9..8f3101e 100644
--- a/tez-api/src/main/java/org/apache/tez/client/TezSession.java
+++ b/tez-api/src/main/java/org/apache/tez/client/TezSession.java
@@ -153,10 +153,6 @@ public class TezSession {
         .getFrameworkClasspath(sessionConfig.getYarnConfiguration());
     for (Vertex v : dag.getVertices()) {
       Map<String, String> taskEnv = v.getTaskEnvironment();
-      if (taskEnv == null) {
-        taskEnv = Maps.newHashMap();
-        v.setTaskEnvironment(taskEnv);
-      }
       Apps.addToEnvironment(taskEnv,
           ApplicationConstants.Environment.CLASSPATH.name(),
           classpath);

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/0320cd7a/tez-api/src/main/java/org/apache/tez/dag/api/DAG.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/dag/api/DAG.java b/tez-api/src/main/java/org/apache/tez/dag/api/DAG.java
index 20da950..6433dc8 100644
--- a/tez-api/src/main/java/org/apache/tez/dag/api/DAG.java
+++ b/tez-api/src/main/java/org/apache/tez/dag/api/DAG.java
@@ -506,39 +506,35 @@ public class DAG { // FIXME rename to Topology
 
       taskConfigBuilder.setTaskModule(vertex.getVertexName());
       PlanLocalResource.Builder localResourcesBuilder = PlanLocalResource.newBuilder();
-      if (vertex.getTaskLocalResources() != null) {
-        localResourcesBuilder.clear();
-        for (Entry<String, LocalResource> entry :
-          vertex.getTaskLocalResources().entrySet()) {
-          String key = entry.getKey();
-          LocalResource lr = entry.getValue();
-          localResourcesBuilder.setName(key);
-          localResourcesBuilder.setUri(
-            DagTypeConverters.convertToDAGPlan(lr.getResource()));
-          localResourcesBuilder.setSize(lr.getSize());
-          localResourcesBuilder.setTimeStamp(lr.getTimestamp());
-          localResourcesBuilder.setType(
-            DagTypeConverters.convertToDAGPlan(lr.getType()));
-          localResourcesBuilder.setVisibility(
-            DagTypeConverters.convertToDAGPlan(lr.getVisibility()));
-          if (lr.getType() == LocalResourceType.PATTERN) {
-            if (lr.getPattern() == null || lr.getPattern().isEmpty()) {
-              throw new TezUncheckedException("LocalResource type set to pattern"
-                + " but pattern is null or empty");
-            }
-            localResourcesBuilder.setPattern(lr.getPattern());
+      localResourcesBuilder.clear();
+      for (Entry<String, LocalResource> entry :
+             vertex.getTaskLocalResources().entrySet()) {
+        String key = entry.getKey();
+        LocalResource lr = entry.getValue();
+        localResourcesBuilder.setName(key);
+        localResourcesBuilder.setUri(
+          DagTypeConverters.convertToDAGPlan(lr.getResource()));
+        localResourcesBuilder.setSize(lr.getSize());
+        localResourcesBuilder.setTimeStamp(lr.getTimestamp());
+        localResourcesBuilder.setType(
+          DagTypeConverters.convertToDAGPlan(lr.getType()));
+        localResourcesBuilder.setVisibility(
+          DagTypeConverters.convertToDAGPlan(lr.getVisibility()));
+        if (lr.getType() == LocalResourceType.PATTERN) {
+          if (lr.getPattern() == null || lr.getPattern().isEmpty()) {
+            throw new TezUncheckedException("LocalResource type set to pattern"
+              + " but pattern is null or empty");
           }
-          taskConfigBuilder.addLocalResource(localResourcesBuilder);
+          localResourcesBuilder.setPattern(lr.getPattern());
         }
+        taskConfigBuilder.addLocalResource(localResourcesBuilder);
       }
       
-      if (vertex.getTaskEnvironment() != null) {
-        for (String key : vertex.getTaskEnvironment().keySet()) {
-          PlanKeyValuePair.Builder envSettingBuilder = PlanKeyValuePair.newBuilder();
-          envSettingBuilder.setKey(key);
-          envSettingBuilder.setValue(vertex.getTaskEnvironment().get(key));
-          taskConfigBuilder.addEnvironmentSetting(envSettingBuilder);
-        }
+      for (String key : vertex.getTaskEnvironment().keySet()) {
+        PlanKeyValuePair.Builder envSettingBuilder = PlanKeyValuePair.newBuilder();
+        envSettingBuilder.setKey(key);
+        envSettingBuilder.setValue(vertex.getTaskEnvironment().get(key));
+        taskConfigBuilder.addEnvironmentSetting(envSettingBuilder);
       }
 
       if (vertex.getTaskLocationsHint() != null) {

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/0320cd7a/tez-api/src/main/java/org/apache/tez/dag/api/Vertex.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/dag/api/Vertex.java b/tez-api/src/main/java/org/apache/tez/dag/api/Vertex.java
index d2e8ac7..377f551 100644
--- a/tez-api/src/main/java/org/apache/tez/dag/api/Vertex.java
+++ b/tez-api/src/main/java/org/apache/tez/dag/api/Vertex.java
@@ -20,6 +20,7 @@ package org.apache.tez.dag.api;
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -42,8 +43,8 @@ public class Vertex {
   private final int parallelism;
   private VertexLocationHint taskLocationsHint;
   private final Resource taskResource;
-  private Map<String, LocalResource> taskLocalResources;
-  private Map<String, String> taskEnvironment;
+  private Map<String, LocalResource> taskLocalResources = new HashMap<String, LocalResource>();
+  private Map<String, String> taskEnvironment = new HashMap<String, String>();
   private final List<RootInputLeafOutput<InputDescriptor>> additionalInputs 
                       = new ArrayList<RootInputLeafOutput<InputDescriptor>>();
   private final List<RootInputLeafOutput<OutputDescriptor>> additionalOutputs

@@ -107,7 +108,11 @@ public class Vertex {
   }
 
   public Vertex setTaskLocalResources(Map<String, LocalResource> localResources) {
-    this.taskLocalResources = localResources;
+    if (localResources == null) {
+      this.taskLocalResources = new HashMap<String, LocalResource>();
+    } else {
+      this.taskLocalResources = localResources;
+    }
     return this;
   }
 
@@ -116,7 +121,12 @@ public class Vertex {
   }
 
   public Vertex setTaskEnvironment(Map<String, String> environment) {
-    this.taskEnvironment = environment;
+    if (environment == null) {
+      this.taskEnvironment = new HashMap<String, String>();
+    }
+    else {
+      this.taskEnvironment = environment;
+    }
     return this;
   }
 


Mime
View raw message