tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hit...@apache.org
Subject [1/2] git commit: TEZ-262. ResourceMgrDelegate should not extend YarnClient. (hitesh)
Date Fri, 21 Jun 2013 00:50:47 GMT
Updated Branches:
  refs/heads/master 5d09d0469 -> 8cf2ae4d1


TEZ-262. ResourceMgrDelegate should not extend YarnClient. (hitesh)


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

Branch: refs/heads/master
Commit: 5b53ae15a445ad4557c6c582cdca8495e0a69535
Parents: 5d09d04
Author: Hitesh Shah <hitesh@apache.org>
Authored: Thu Jun 20 17:33:40 2013 -0700
Committer: Hitesh Shah <hitesh@apache.org>
Committed: Thu Jun 20 17:33:40 2013 -0700

----------------------------------------------------------------------
 .../tez/mapreduce/ResourceMgrDelegate.java      | 45 +++++++++++++-------
 1 file changed, 30 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/5b53ae15/tez-yarn-client/src/main/java/org/apache/tez/mapreduce/ResourceMgrDelegate.java
----------------------------------------------------------------------
diff --git a/tez-yarn-client/src/main/java/org/apache/tez/mapreduce/ResourceMgrDelegate.java
b/tez-yarn-client/src/main/java/org/apache/tez/mapreduce/ResourceMgrDelegate.java
index e566026..3bf9958 100644
--- a/tez-yarn-client/src/main/java/org/apache/tez/mapreduce/ResourceMgrDelegate.java
+++ b/tez-yarn-client/src/main/java/org/apache/tez/mapreduce/ResourceMgrDelegate.java
@@ -19,6 +19,7 @@
 package org.apache.tez.mapreduce;
 
 import java.io.IOException;
+import java.net.InetSocketAddress;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -39,18 +40,20 @@ import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
 import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.YarnClusterMetrics;
-import org.apache.hadoop.yarn.client.api.impl.YarnClientImpl;
+import org.apache.hadoop.yarn.client.api.YarnClient;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.exceptions.YarnException;
 import org.apache.hadoop.yarn.util.ConverterUtils;
 import org.apache.tez.mapreduce.hadoop.MRJobConfig;
 
-public class ResourceMgrDelegate extends YarnClientImpl {
+public class ResourceMgrDelegate {
   private static final Log LOG = LogFactory.getLog(ResourceMgrDelegate.class);
       
   private YarnConfiguration conf;
   private GetNewApplicationResponse application;
   private ApplicationId applicationId;
+  private YarnClient client;
+  private InetSocketAddress rmAddress;
 
   /**
    * Delegate responsible for communicating with the Resource Manager's {@link ApplicationClientProtocol}.
@@ -59,14 +62,18 @@ public class ResourceMgrDelegate extends YarnClientImpl {
   public ResourceMgrDelegate(YarnConfiguration conf) {
     super();
     this.conf = conf;
-    init(conf);
-    start();
+    client = YarnClient.createYarnClient();
+    client.init(conf);
+    this.rmAddress = conf.getSocketAddr(YarnConfiguration.RM_ADDRESS,
+        YarnConfiguration.DEFAULT_RM_ADDRESS,
+        YarnConfiguration.DEFAULT_RM_PORT);
+    client.start();
   }
 
   public TaskTrackerInfo[] getActiveTrackers() throws IOException,
       InterruptedException {
     try {
-      return TypeConverter.fromYarnNodes(super.getNodeReports());
+      return TypeConverter.fromYarnNodes(client.getNodeReports());
     } catch (YarnException e) {
       throw new IOException(e);
     }
@@ -74,7 +81,7 @@ public class ResourceMgrDelegate extends YarnClientImpl {
 
   public JobStatus[] getAllJobs() throws IOException, InterruptedException {
     try {
-      return TypeConverter.fromYarnApps(super.getApplicationList(), this.conf);
+      return TypeConverter.fromYarnApps(client.getApplicationList(), this.conf);
     } catch (YarnException e) {
       throw new IOException(e);
     }
@@ -91,7 +98,7 @@ public class ResourceMgrDelegate extends YarnClientImpl {
       InterruptedException {
     YarnClusterMetrics metrics;
     try {
-      metrics = super.getYarnClusterMetrics();
+      metrics = client.getYarnClusterMetrics();
     } catch (YarnException e) {
       throw new IOException(e);
     }
@@ -105,8 +112,9 @@ public class ResourceMgrDelegate extends YarnClientImpl {
   public Token getDelegationToken(Text renewer) throws IOException,
       InterruptedException {
     try {
+      // Remove rmAddress after YARN-868 is addressed
       return ConverterUtils.convertFromYarn(
-        super.getRMDelegationToken(renewer), rmAddress);
+        client.getRMDelegationToken(renewer), rmAddress);
     } catch (YarnException e) {
       throw new IOException(e);
     }
@@ -119,7 +127,7 @@ public class ResourceMgrDelegate extends YarnClientImpl {
   public JobID getNewJobID() throws IOException, InterruptedException {
     try {
       this.application = 
-          super.createApplication().getNewApplicationResponse();
+          client.createApplication().getNewApplicationResponse();
     } catch (YarnException e) {
       throw new IOException(e);
     }
@@ -131,7 +139,7 @@ public class ResourceMgrDelegate extends YarnClientImpl {
   InterruptedException {
     try {
       return TypeConverter.fromYarn(
-          super.getQueueInfo(queueName), this.conf);
+          client.getQueueInfo(queueName), this.conf);
     } catch (YarnException e) {
       throw new IOException(e);
     }
@@ -140,8 +148,8 @@ public class ResourceMgrDelegate extends YarnClientImpl {
   public QueueAclsInfo[] getQueueAclsForCurrentUser() throws IOException,
       InterruptedException {
     try {
-      return TypeConverter.fromYarnQueueUserAclsInfo(super
-        .getQueueAclsInfo());
+      return TypeConverter.fromYarnQueueUserAclsInfo(
+          client.getQueueAclsInfo());
     } catch (YarnException e) {
       throw new IOException(e);
     }
@@ -149,7 +157,7 @@ public class ResourceMgrDelegate extends YarnClientImpl {
 
   public QueueInfo[] getQueues() throws IOException, InterruptedException {
     try {
-      return TypeConverter.fromYarnQueueInfo(super.getAllQueues(), this.conf);
+      return TypeConverter.fromYarnQueueInfo(client.getAllQueues(), this.conf);
     } catch (YarnException e) {
       throw new IOException(e);
     }
@@ -157,7 +165,8 @@ public class ResourceMgrDelegate extends YarnClientImpl {
 
   public QueueInfo[] getRootQueues() throws IOException, InterruptedException {
     try {
-      return TypeConverter.fromYarnQueueInfo(super.getRootQueueInfos(), this.conf);
+      return TypeConverter.fromYarnQueueInfo(client.getRootQueueInfos(),
+          this.conf);
     } catch (YarnException e) {
       throw new IOException(e);
     }
@@ -166,7 +175,7 @@ public class ResourceMgrDelegate extends YarnClientImpl {
   public QueueInfo[] getChildQueues(String parent) throws IOException,
       InterruptedException {
     try {
-      return TypeConverter.fromYarnQueueInfo(super.getChildQueueInfos(parent),
+      return TypeConverter.fromYarnQueueInfo(client.getChildQueueInfos(parent),
         this.conf);
     } catch (YarnException e) {
       throw new IOException(e);
@@ -208,4 +217,10 @@ public class ResourceMgrDelegate extends YarnClientImpl {
   public ApplicationId getApplicationId() {
     return applicationId;
   }
+
+  public void killApplication(ApplicationId appId)
+      throws YarnException, IOException {
+    client.killApplication(appId);
+  }
+
 }


Mime
View raw message