diff --git hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java index 303f345..cea4364 100644 --- hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java +++ hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java @@ -137,7 +137,7 @@ private NotRunningJob getNotRunningJob(ApplicationReport applicationReport, } } - private MRClientProtocol getProxy() throws YarnRemoteException { + private MRClientProtocol getProxy() throws YarnRemoteException, IOException { if (realProxy != null) { return realProxy; } diff --git hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientServiceDelegate.java hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientServiceDelegate.java index 982a7e1..da65708 100644 --- hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientServiceDelegate.java +++ hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientServiceDelegate.java @@ -362,7 +362,7 @@ public void testRMDownRestoreForJobStatusBeforeGetAMReport() } private void testRMDownForJobStatusBeforeGetAMReport(Configuration conf, - int noOfRetries) throws YarnRemoteException { + int noOfRetries) throws YarnRemoteException, IOException { conf.set(MRConfig.FRAMEWORK_NAME, MRConfig.YARN_FRAMEWORK_NAME); conf.setBoolean(MRJobConfig.JOB_AM_ACCESS_DISABLED, !isAMReachableFromClient); @@ -429,7 +429,8 @@ private ApplicationReport getRunningApplicationReport(String host, int port) { "N/A", 0.0f); } - private ResourceMgrDelegate getRMDelegate() throws YarnRemoteException { + private ResourceMgrDelegate getRMDelegate() throws YarnRemoteException, + IOException { ResourceMgrDelegate rm = mock(ResourceMgrDelegate.class); when(rm.getApplicationReport(jobId.getAppId())).thenReturn(null); return rm; diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ClientRMProtocol.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ClientRMProtocol.java index bfb4fce..5824952 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ClientRMProtocol.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ClientRMProtocol.java @@ -18,6 +18,8 @@ package org.apache.hadoop.yarn.api; +import java.io.IOException; + import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; @@ -78,11 +80,12 @@ * @return response containing the new ApplicationId to be used * to submit an application * @throws YarnRemoteException + * @throws IOException * @see #submitApplication(SubmitApplicationRequest) */ public GetNewApplicationResponse getNewApplication( GetNewApplicationRequest request) - throws YarnRemoteException; + throws YarnRemoteException, IOException; /** *

The interface used by clients to submit a new application to the @@ -106,11 +109,12 @@ public GetNewApplicationResponse getNewApplication( * @param request request to submit a new application * @return (empty) response on accepting the submission * @throws YarnRemoteException + * @throws IOException * @see #getNewApplication(GetNewApplicationRequest) */ public SubmitApplicationResponse submitApplication( SubmitApplicationRequest request) - throws YarnRemoteException; + throws YarnRemoteException, IOException; /** *

The interface used by clients to request the @@ -129,11 +133,12 @@ public SubmitApplicationResponse submitApplication( * @return ResourceManager returns an empty response * on success and throws an exception on rejecting the request * @throws YarnRemoteException + * @throws IOException * @see #getQueueUserAcls(GetQueueUserAclsInfoRequest) */ public KillApplicationResponse forceKillApplication( KillApplicationRequest request) - throws YarnRemoteException; + throws YarnRemoteException, IOException; /** *

The interface used by clients to get a report of an Application from @@ -164,10 +169,11 @@ public KillApplicationResponse forceKillApplication( * @param request request for an application report * @return application report * @throws YarnRemoteException + * @throws IOException */ public GetApplicationReportResponse getApplicationReport( GetApplicationReportRequest request) - throws YarnRemoteException; + throws YarnRemoteException, IOException; /** *

The interface used by clients to get metrics about the cluster from @@ -181,10 +187,11 @@ public GetApplicationReportResponse getApplicationReport( * @param request request for cluster metrics * @return cluster metrics * @throws YarnRemoteException + * @throws IOException */ public GetClusterMetricsResponse getClusterMetrics( GetClusterMetricsRequest request) - throws YarnRemoteException; + throws YarnRemoteException, IOException; /** *

The interface used by clients to get a report of all Applications @@ -202,10 +209,11 @@ public GetClusterMetricsResponse getClusterMetrics( * @param request request for report on all running applications * @return report on all running applications * @throws YarnRemoteException + * @throws IOException */ public GetAllApplicationsResponse getAllApplications( GetAllApplicationsRequest request) - throws YarnRemoteException; + throws YarnRemoteException, IOException; /** *

The interface used by clients to get a report of all nodes @@ -218,10 +226,11 @@ public GetAllApplicationsResponse getAllApplications( * @param request request for report on all nodes * @return report on all nodes * @throws YarnRemoteException + * @throws IOException */ public GetClusterNodesResponse getClusterNodes( GetClusterNodesRequest request) - throws YarnRemoteException; + throws YarnRemoteException, IOException; /** *

The interface used by clients to get information about queues @@ -236,10 +245,11 @@ public GetClusterNodesResponse getClusterNodes( * @param request request to get queue information * @return queue information * @throws YarnRemoteException + * @throws IOException */ public GetQueueInfoResponse getQueueInfo( GetQueueInfoRequest request) - throws YarnRemoteException; + throws YarnRemoteException, IOException; /** *

The interface used by clients to get information about queue @@ -252,10 +262,11 @@ public GetQueueInfoResponse getQueueInfo( * @param request request to get queue acls for current user * @return queue acls for current user * @throws YarnRemoteException + * @throws IOException */ public GetQueueUserAclsInfoResponse getQueueUserAcls( GetQueueUserAclsInfoRequest request) - throws YarnRemoteException; + throws YarnRemoteException, IOException; /** *

The interface used by clients to get delegation token, enabling the @@ -267,10 +278,11 @@ public GetQueueUserAclsInfoResponse getQueueUserAcls( * @param request request to get a delegation token for the client. * @return delegation token that can be used to talk to this service * @throws YarnRemoteException + * @throws IOException */ public GetDelegationTokenResponse getDelegationToken( GetDelegationTokenRequest request) - throws YarnRemoteException; + throws YarnRemoteException, IOException; /** * Renew an existing delegation token. @@ -278,10 +290,12 @@ public GetDelegationTokenResponse getDelegationToken( * @param request the delegation token to be renewed. * @return the new expiry time for the delegation token. * @throws YarnRemoteException + * @throws IOException */ @Private public RenewDelegationTokenResponse renewDelegationToken( - RenewDelegationTokenRequest request) throws YarnRemoteException; + RenewDelegationTokenRequest request) throws YarnRemoteException, + IOException; /** * Cancel an existing delegation token. @@ -289,8 +303,10 @@ public RenewDelegationTokenResponse renewDelegationToken( * @param request the delegation token to be cancelled. * @return an empty response. * @throws YarnRemoteException + * @throws IOException */ @Private public CancelDelegationTokenResponse cancelDelegationToken( - CancelDelegationTokenRequest request) throws YarnRemoteException; + CancelDelegationTokenRequest request) throws YarnRemoteException, + IOException; } diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java index 927dfe3..8cbf2de 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java @@ -592,8 +592,10 @@ else if (amMemory > maxMem) { * @param appId Application Id of application to be monitored * @return true if application completed successfully * @throws YarnRemoteException + * @throws IOException */ - private boolean monitorApplication(ApplicationId appId) throws YarnRemoteException { + private boolean monitorApplication(ApplicationId appId) + throws YarnRemoteException, IOException { while (true) { @@ -655,8 +657,10 @@ else if (YarnApplicationState.KILLED == state * Kill a submitted application by sending a call to the ASM * @param appId Application Id to be killed. * @throws YarnRemoteException + * @throws IOException */ - private void forceKillApplication(ApplicationId appId) throws YarnRemoteException { + private void forceKillApplication(ApplicationId appId) + throws YarnRemoteException, IOException { // TODO clarify whether multiple jobs with the same app id can be submitted and be running at // the same time. // If yes, can we kill a particular attempt only? diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/src/main/java/org/apache/hadoop/yarn/applications/unmanagedamlauncher/UnmanagedAMLauncher.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/src/main/java/org/apache/hadoop/yarn/applications/unmanagedamlauncher/UnmanagedAMLauncher.java index f05eca6..5805e2b 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/src/main/java/org/apache/hadoop/yarn/applications/unmanagedamlauncher/UnmanagedAMLauncher.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/src/main/java/org/apache/hadoop/yarn/applications/unmanagedamlauncher/UnmanagedAMLauncher.java @@ -357,9 +357,11 @@ public boolean run() throws IOException, YarnRemoteException { * Application Id of application to be monitored * @return true if application completed successfully * @throws YarnRemoteException + * @throws IOException */ private ApplicationReport monitorApplication(ApplicationId appId, - Set finalState) throws YarnRemoteException { + Set finalState) throws YarnRemoteException, + IOException { long foundAMCompletedTime = 0; final int timeToWaitMS = 10000; diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/YarnClient.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/YarnClient.java index afd21d0..adbcf67 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/YarnClient.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/YarnClient.java @@ -18,6 +18,7 @@ package org.apache.hadoop.yarn.client; +import java.io.IOException; import java.util.List; import org.apache.hadoop.classification.InterfaceAudience; @@ -58,8 +59,10 @@ * @return response containing the new ApplicationId to be used * to submit an application * @throws YarnRemoteException + * @throws IOException */ - GetNewApplicationResponse getNewApplication() throws YarnRemoteException; + GetNewApplicationResponse getNewApplication() throws YarnRemoteException, + IOException; /** *

@@ -73,10 +76,11 @@ * needed to submit a new application * @return {@link ApplicationId} of the accepted application * @throws YarnRemoteException + * @throws IOException * @see #getNewApplication() */ ApplicationId submitApplication(ApplicationSubmissionContext appContext) - throws YarnRemoteException; + throws YarnRemoteException, IOException; /** *

@@ -88,9 +92,11 @@ ApplicationId submitApplication(ApplicationSubmissionContext appContext) * @throws YarnRemoteException * in case of errors or if YARN rejects the request due to * access-control restrictions. + * @throws IOException * @see #getQueueAclsInfo() */ - void killApplication(ApplicationId applicationId) throws YarnRemoteException; + void killApplication(ApplicationId applicationId) throws YarnRemoteException, + IOException; /** *

@@ -120,9 +126,10 @@ ApplicationId submitApplication(ApplicationSubmissionContext appContext) * {@link ApplicationId} of the application that needs a report * @return application report * @throws YarnRemoteException + * @throws IOException */ ApplicationReport getApplicationReport(ApplicationId appId) - throws YarnRemoteException; + throws YarnRemoteException, IOException; /** *

@@ -137,8 +144,10 @@ ApplicationReport getApplicationReport(ApplicationId appId) * * @return a list of reports of all running applications * @throws YarnRemoteException + * @throws IOException */ - List getApplicationList() throws YarnRemoteException; + List getApplicationList() throws YarnRemoteException, + IOException; /** *

@@ -147,8 +156,10 @@ ApplicationReport getApplicationReport(ApplicationId appId) * * @return cluster metrics * @throws YarnRemoteException + * @throws IOException */ - YarnClusterMetrics getYarnClusterMetrics() throws YarnRemoteException; + YarnClusterMetrics getYarnClusterMetrics() throws YarnRemoteException, + IOException; /** *

@@ -157,8 +168,9 @@ ApplicationReport getApplicationReport(ApplicationId appId) * * @return A list of report of all nodes * @throws YarnRemoteException + * @throws IOException */ - List getNodeReports() throws YarnRemoteException; + List getNodeReports() throws YarnRemoteException, IOException; /** *

@@ -170,8 +182,10 @@ ApplicationReport getApplicationReport(ApplicationId appId) * @return a delegation token ({@link DelegationToken}) that can be used to * talk to YARN * @throws YarnRemoteException + * @throws IOException */ - DelegationToken getRMDelegationToken(Text renewer) throws YarnRemoteException; + DelegationToken getRMDelegationToken(Text renewer) + throws YarnRemoteException, IOException; /** *

@@ -184,8 +198,10 @@ ApplicationReport getApplicationReport(ApplicationId appId) * @throws YarnRemoteException * in case of errors or if YARN rejects the request due to * access-control restrictions. + * @throws IOException */ - QueueInfo getQueueInfo(String queueName) throws YarnRemoteException; + QueueInfo getQueueInfo(String queueName) throws YarnRemoteException, + IOException; /** *

@@ -195,8 +211,9 @@ ApplicationReport getApplicationReport(ApplicationId appId) * * @return a list of queue-information for all queues * @throws YarnRemoteException + * @throws IOException */ - List getAllQueues() throws YarnRemoteException; + List getAllQueues() throws YarnRemoteException, IOException; /** *

@@ -205,8 +222,9 @@ ApplicationReport getApplicationReport(ApplicationId appId) * * @return a list of queue-information for all the top-level queues * @throws YarnRemoteException + * @throws IOException */ - List getRootQueueInfos() throws YarnRemoteException; + List getRootQueueInfos() throws YarnRemoteException, IOException; /** *

@@ -219,8 +237,10 @@ ApplicationReport getApplicationReport(ApplicationId appId) * @return a list of queue-information for all queues who are direct children * of the given parent queue. * @throws YarnRemoteException + * @throws IOException */ - List getChildQueueInfos(String parent) throws YarnRemoteException; + List getChildQueueInfos(String parent) throws YarnRemoteException, + IOException; /** *

@@ -231,6 +251,8 @@ ApplicationReport getApplicationReport(ApplicationId appId) * @return a list of queue acls ({@link QueueUserACLInfo}) for * current user * @throws YarnRemoteException + * @throws IOException */ - List getQueueAclsInfo() throws YarnRemoteException; + List getQueueAclsInfo() throws YarnRemoteException, + IOException; } diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/YarnClientImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/YarnClientImpl.java index 6be9052..556cb35 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/YarnClientImpl.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/YarnClientImpl.java @@ -18,6 +18,7 @@ package org.apache.hadoop.yarn.client; +import java.io.IOException; import java.net.InetSocketAddress; import java.util.ArrayList; import java.util.List; @@ -121,7 +122,7 @@ public synchronized void stop() { @Override public GetNewApplicationResponse getNewApplication() - throws YarnRemoteException { + throws YarnRemoteException, IOException { GetNewApplicationRequest request = Records.newRecord(GetNewApplicationRequest.class); return rmClient.getNewApplication(request); @@ -130,7 +131,7 @@ public GetNewApplicationResponse getNewApplication() @Override public ApplicationId submitApplication(ApplicationSubmissionContext appContext) - throws YarnRemoteException { + throws YarnRemoteException, IOException { ApplicationId applicationId = appContext.getApplicationId(); appContext.setApplicationId(applicationId); SubmitApplicationRequest request = @@ -167,7 +168,7 @@ public GetNewApplicationResponse getNewApplication() @Override public void killApplication(ApplicationId applicationId) - throws YarnRemoteException { + throws YarnRemoteException, IOException { LOG.info("Killing application " + applicationId); KillApplicationRequest request = Records.newRecord(KillApplicationRequest.class); @@ -177,7 +178,7 @@ public void killApplication(ApplicationId applicationId) @Override public ApplicationReport getApplicationReport(ApplicationId appId) - throws YarnRemoteException { + throws YarnRemoteException, IOException { GetApplicationReportRequest request = Records.newRecord(GetApplicationReportRequest.class); request.setApplicationId(appId); @@ -188,7 +189,7 @@ public ApplicationReport getApplicationReport(ApplicationId appId) @Override public List getApplicationList() - throws YarnRemoteException { + throws YarnRemoteException, IOException { GetAllApplicationsRequest request = Records.newRecord(GetAllApplicationsRequest.class); GetAllApplicationsResponse response = rmClient.getAllApplications(request); @@ -196,7 +197,8 @@ public ApplicationReport getApplicationReport(ApplicationId appId) } @Override - public YarnClusterMetrics getYarnClusterMetrics() throws YarnRemoteException { + public YarnClusterMetrics getYarnClusterMetrics() throws YarnRemoteException, + IOException { GetClusterMetricsRequest request = Records.newRecord(GetClusterMetricsRequest.class); GetClusterMetricsResponse response = rmClient.getClusterMetrics(request); @@ -204,7 +206,8 @@ public YarnClusterMetrics getYarnClusterMetrics() throws YarnRemoteException { } @Override - public List getNodeReports() throws YarnRemoteException { + public List getNodeReports() throws YarnRemoteException, + IOException { GetClusterNodesRequest request = Records.newRecord(GetClusterNodesRequest.class); GetClusterNodesResponse response = rmClient.getClusterNodes(request); @@ -213,7 +216,7 @@ public YarnClusterMetrics getYarnClusterMetrics() throws YarnRemoteException { @Override public DelegationToken getRMDelegationToken(Text renewer) - throws YarnRemoteException { + throws YarnRemoteException, IOException { /* get the token from RM */ GetDelegationTokenRequest rmDTRequest = Records.newRecord(GetDelegationTokenRequest.class); @@ -236,7 +239,8 @@ public DelegationToken getRMDelegationToken(Text renewer) } @Override - public QueueInfo getQueueInfo(String queueName) throws YarnRemoteException { + public QueueInfo getQueueInfo(String queueName) throws YarnRemoteException, + IOException { GetQueueInfoRequest request = getQueueInfoRequest(queueName, true, false, false); Records.newRecord(GetQueueInfoRequest.class); @@ -244,14 +248,16 @@ public QueueInfo getQueueInfo(String queueName) throws YarnRemoteException { } @Override - public List getQueueAclsInfo() throws YarnRemoteException { + public List getQueueAclsInfo() throws YarnRemoteException, + IOException { GetQueueUserAclsInfoRequest request = Records.newRecord(GetQueueUserAclsInfoRequest.class); return rmClient.getQueueUserAcls(request).getUserAclsInfoList(); } @Override - public List getAllQueues() throws YarnRemoteException { + public List getAllQueues() throws YarnRemoteException, + IOException { List queues = new ArrayList(); QueueInfo rootQueue = @@ -262,7 +268,8 @@ public QueueInfo getQueueInfo(String queueName) throws YarnRemoteException { } @Override - public List getRootQueueInfos() throws YarnRemoteException { + public List getRootQueueInfos() throws YarnRemoteException, + IOException { List queues = new ArrayList(); QueueInfo rootQueue = @@ -274,7 +281,7 @@ public QueueInfo getQueueInfo(String queueName) throws YarnRemoteException { @Override public List getChildQueueInfos(String parent) - throws YarnRemoteException { + throws YarnRemoteException, IOException { List queues = new ArrayList(); QueueInfo parentQueue = diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/ApplicationCLI.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/ApplicationCLI.java index 5797e34..1f1703b 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/ApplicationCLI.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/ApplicationCLI.java @@ -91,8 +91,9 @@ private void printUsage(Options opts) { * Lists all the applications present in the Resource Manager * * @throws YarnRemoteException + * @throws IOException */ - private void listAllApplications() throws YarnRemoteException { + private void listAllApplications() throws YarnRemoteException, IOException { PrintWriter writer = new PrintWriter(sysout); List appsReport = client.getApplicationList(); @@ -117,8 +118,10 @@ private void listAllApplications() throws YarnRemoteException { * * @param applicationId * @throws YarnRemoteException + * @throws IOException */ - private void killApplication(String applicationId) throws YarnRemoteException { + private void killApplication(String applicationId) + throws YarnRemoteException, IOException { ApplicationId appId = ConverterUtils.toApplicationId(applicationId); sysout.println("Killing application " + applicationId); client.killApplication(appId); diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/NodeCLI.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/NodeCLI.java index 943a673..83033ae 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/NodeCLI.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/NodeCLI.java @@ -84,8 +84,9 @@ private void printUsage(Options opts) { * Lists all the nodes present in the cluster * * @throws YarnRemoteException + * @throws IOException */ - private void listClusterNodes() throws YarnRemoteException { + private void listClusterNodes() throws YarnRemoteException, IOException { PrintWriter writer = new PrintWriter(sysout); List nodesReport = client.getNodeReports(); writer.println("Total Nodes:" + nodesReport.size()); diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestAMRMClient.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestAMRMClient.java index a4d65db..e886c67 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestAMRMClient.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestAMRMClient.java @@ -23,6 +23,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import java.io.IOException; import java.util.List; import java.util.Set; import java.util.TreeSet; @@ -69,7 +70,7 @@ int nodeCount = 3; @Before - public void setup() throws YarnRemoteException { + public void setup() throws YarnRemoteException, IOException { // start minicluster conf = new YarnConfiguration(); yarnCluster = new MiniYARNCluster(TestAMRMClient.class.getName(), nodeCount, 1, 1); diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestYarnClient.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestYarnClient.java index ccfc8d9..098c7d4 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestYarnClient.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestYarnClient.java @@ -23,6 +23,9 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; + +import java.io.IOException; + import junit.framework.Assert; import org.apache.hadoop.conf.Configuration; @@ -89,6 +92,8 @@ public void testSubmitApplication() { client.submitApplication(context); } catch (YarnRemoteException e) { Assert.fail("Exception is not expected."); + } catch (IOException e) { + Assert.fail("Exception is not expected."); } verify(((MockYarnClient) client).mockReport,times(4 * i + 4)) .getYarnApplicationState(); @@ -115,6 +120,8 @@ public void start() { GetApplicationReportRequest.class))).thenReturn(mockResponse); } catch (YarnRemoteException e) { Assert.fail("Exception is not expected."); + } catch (IOException e) { + Assert.fail("Exception is not expected."); } when(mockResponse.getApplicationReport()).thenReturn(mockReport); } diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ClientRMProtocolPBServiceImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ClientRMProtocolPBServiceImpl.java index 1c2d5b0..8fb1b71 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ClientRMProtocolPBServiceImpl.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ClientRMProtocolPBServiceImpl.java @@ -18,6 +18,8 @@ package org.apache.hadoop.yarn.api.impl.pb.service; +import java.io.IOException; + import org.apache.hadoop.security.proto.SecurityProtos.CancelDelegationTokenRequestProto; import org.apache.hadoop.security.proto.SecurityProtos.CancelDelegationTokenResponseProto; import org.apache.hadoop.security.proto.SecurityProtos.GetDelegationTokenRequestProto; @@ -102,6 +104,8 @@ public KillApplicationResponseProto forceKillApplication(RpcController arg0, return ((KillApplicationResponsePBImpl)response).getProto(); } catch (YarnRemoteException e) { throw new ServiceException(e); + } catch (IOException e) { + throw new ServiceException(e); } } @@ -115,6 +119,8 @@ public GetApplicationReportResponseProto getApplicationReport( return ((GetApplicationReportResponsePBImpl)response).getProto(); } catch (YarnRemoteException e) { throw new ServiceException(e); + } catch (IOException e) { + throw new ServiceException(e); } } @@ -127,6 +133,8 @@ public GetClusterMetricsResponseProto getClusterMetrics(RpcController arg0, return ((GetClusterMetricsResponsePBImpl)response).getProto(); } catch (YarnRemoteException e) { throw new ServiceException(e); + } catch (IOException e) { + throw new ServiceException(e); } } @@ -140,6 +148,8 @@ public GetNewApplicationResponseProto getNewApplication( return ((GetNewApplicationResponsePBImpl)response).getProto(); } catch (YarnRemoteException e) { throw new ServiceException(e); + } catch (IOException e) { + throw new ServiceException(e); } } @@ -152,6 +162,8 @@ public SubmitApplicationResponseProto submitApplication(RpcController arg0, return ((SubmitApplicationResponsePBImpl)response).getProto(); } catch (YarnRemoteException e) { throw new ServiceException(e); + } catch (IOException e) { + throw new ServiceException(e); } } @@ -166,6 +178,8 @@ public GetAllApplicationsResponseProto getAllApplications( return ((GetAllApplicationsResponsePBImpl)response).getProto(); } catch (YarnRemoteException e) { throw new ServiceException(e); + } catch (IOException e) { + throw new ServiceException(e); } } @@ -179,6 +193,8 @@ public GetClusterNodesResponseProto getClusterNodes(RpcController controller, return ((GetClusterNodesResponsePBImpl)response).getProto(); } catch (YarnRemoteException e) { throw new ServiceException(e); + } catch (IOException e) { + throw new ServiceException(e); } } @@ -192,6 +208,8 @@ public GetQueueInfoResponseProto getQueueInfo(RpcController controller, return ((GetQueueInfoResponsePBImpl)response).getProto(); } catch (YarnRemoteException e) { throw new ServiceException(e); + } catch (IOException e) { + throw new ServiceException(e); } } @@ -206,6 +224,8 @@ public GetQueueUserAclsInfoResponseProto getQueueUserAcls( return ((GetQueueUserAclsInfoResponsePBImpl)response).getProto(); } catch (YarnRemoteException e) { throw new ServiceException(e); + } catch (IOException e) { + throw new ServiceException(e); } } @@ -220,6 +240,8 @@ public GetDelegationTokenResponseProto getDelegationToken( return ((GetDelegationTokenResponsePBImpl)response).getProto(); } catch (YarnRemoteException e) { throw new ServiceException(e); + } catch (IOException e) { + throw new ServiceException(e); } } @@ -234,6 +256,8 @@ public RenewDelegationTokenResponseProto renewDelegationToken( return ((RenewDelegationTokenResponsePBImpl)response).getProto(); } catch (YarnRemoteException e) { throw new ServiceException(e); + } catch (IOException e) { + throw new ServiceException(e); } } @@ -248,6 +272,8 @@ public CancelDelegationTokenResponseProto cancelDelegationToken( return ((CancelDelegationTokenResponsePBImpl)response).getProto(); } catch (YarnRemoteException e) { throw new ServiceException(e); + } catch (IOException e) { + throw new ServiceException(e); } } } diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java index 2259970..0855a6f 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java @@ -18,6 +18,7 @@ package org.apache.hadoop.yarn.server.resourcemanager; +import java.io.IOException; import java.nio.ByteBuffer; import java.security.PrivilegedAction; import java.util.Map; @@ -199,6 +200,8 @@ public SubmitApplicationResponse run() { return client.submitApplication(req); } catch (YarnRemoteException e) { e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); } return null; } diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMTokens.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMTokens.java index 55b8c93..d334cc5 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMTokens.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMTokens.java @@ -339,7 +339,7 @@ private DelegationToken getDelegationToken( DelegationToken token = loggedInUser .doAs(new PrivilegedExceptionAction() { @Override - public DelegationToken run() throws YarnRemoteException { + public DelegationToken run() throws YarnRemoteException, IOException { GetDelegationTokenRequest request = Records .newRecord(GetDelegationTokenRequest.class); request.setRenewer(renewerString); @@ -355,7 +355,7 @@ private long renewDelegationToken(final UserGroupInformation loggedInUser, throws IOException, InterruptedException { long nextExpTime = loggedInUser.doAs(new PrivilegedExceptionAction() { @Override - public Long run() throws YarnRemoteException { + public Long run() throws YarnRemoteException, IOException { RenewDelegationTokenRequest request = Records .newRecord(RenewDelegationTokenRequest.class); request.setDelegationToken(dToken); @@ -371,7 +371,7 @@ private void cancelDelegationToken(final UserGroupInformation loggedInUser, throws IOException, InterruptedException { loggedInUser.doAs(new PrivilegedExceptionAction() { @Override - public Void run() throws YarnRemoteException { + public Void run() throws YarnRemoteException, IOException { CancelDelegationTokenRequest request = Records .newRecord(CancelDelegationTokenRequest.class); request.setDelegationToken(dToken); diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/AppReportFetcher.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/AppReportFetcher.java index 938a893..120cf72 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/AppReportFetcher.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/AppReportFetcher.java @@ -18,6 +18,7 @@ package org.apache.hadoop.yarn.server.webproxy; +import java.io.IOException; import java.net.InetSocketAddress; import org.apache.commons.logging.Log; @@ -78,9 +79,10 @@ public AppReportFetcher(Configuration conf, ClientRMProtocol applicationsManager * @param appId the id of the application to get. * @return the ApplicationReport for that app. * @throws YarnRemoteException on any error. + * @throws IOException */ public ApplicationReport getApplicationReport(ApplicationId appId) - throws YarnRemoteException { + throws YarnRemoteException, IOException { GetApplicationReportRequest request = recordFactory .newRecordInstance(GetApplicationReportRequest.class); request.setApplicationId(appId);