@Override public GetJobReportResponseProto getJobReport(RpcController controller, GetJobReportRequestProto proto) throws ServiceException { GetJobReportRequestPBImpl request = new GetJobReportRequestPBImpl(proto); try { GetJobReportResponse response = real.getJobReport(request); return ((GetJobReportResponsePBImpl)response).getProto(); } catch (IOException e) { throw new ServiceException(e); } }
@Override public GetJobReportResponseProto getJobReport(RpcController controller, GetJobReportRequestProto proto) throws ServiceException { GetJobReportRequestPBImpl request = new GetJobReportRequestPBImpl(proto); try { GetJobReportResponse response = real.getJobReport(request); return ((GetJobReportResponsePBImpl)response).getProto(); } catch (IOException e) { throw new ServiceException(e); } }
@Override public GetJobReportResponseProto getJobReport(RpcController controller, GetJobReportRequestProto proto) throws ServiceException { GetJobReportRequestPBImpl request = new GetJobReportRequestPBImpl(proto); try { GetJobReportResponse response = real.getJobReport(request); return ((GetJobReportResponsePBImpl)response).getProto(); } catch (IOException e) { throw new ServiceException(e); } }
@Override public GetJobReportResponseProto getJobReport(RpcController controller, GetJobReportRequestProto proto) throws ServiceException { GetJobReportRequestPBImpl request = new GetJobReportRequestPBImpl(proto); try { GetJobReportResponse response = real.getJobReport(request); return ((GetJobReportResponsePBImpl)response).getProto(); } catch (IOException e) { throw new ServiceException(e); } }
@Test public void testRetriesOnConnectionFailure() throws Exception { MRClientProtocol historyServerProxy = mock(MRClientProtocol.class); when(historyServerProxy.getJobReport(getJobReportRequest())).thenThrow( new RuntimeException("1")).thenThrow(new RuntimeException("2")) .thenReturn(getJobReportResponse()); ResourceMgrDelegate rm = mock(ResourceMgrDelegate.class); when(rm.getApplicationReport(TypeConverter.toYarn(oldJobId).getAppId())) .thenReturn(null); ClientServiceDelegate clientServiceDelegate = getClientServiceDelegate( historyServerProxy, rm); JobStatus jobStatus = clientServiceDelegate.getJobStatus(oldJobId); Assert.assertNotNull(jobStatus); verify(historyServerProxy, times(3)).getJobReport( any(GetJobReportRequest.class)); }
when(amProxy.getJobReport(any(GetJobReportRequest.class))) .thenThrow(new RuntimeException("11")) .thenThrow(new RuntimeException("22")) MRJobConfig.DEFAULT_MR_CLIENT_MAX_RETRIES), clientServiceDelegate .getMaxClientRetry()); verify(amProxy, times(5)).getJobReport(any(GetJobReportRequest.class));
@Test public void testRMDownRestoreForJobStatusBeforeGetAMReport() throws IOException { Configuration conf = new YarnConfiguration(); conf.setInt(MRJobConfig.MR_CLIENT_MAX_RETRIES, 3); conf.set(MRConfig.FRAMEWORK_NAME, MRConfig.YARN_FRAMEWORK_NAME); conf.setBoolean(MRJobConfig.JOB_AM_ACCESS_DISABLED, !isAMReachableFromClient); MRClientProtocol historyServerProxy = mock(MRClientProtocol.class); when(historyServerProxy.getJobReport(any(GetJobReportRequest.class))) .thenReturn(getJobReportResponse()); ResourceMgrDelegate rmDelegate = mock(ResourceMgrDelegate.class); try { when(rmDelegate.getApplicationReport(jobId.getAppId())).thenThrow( new java.lang.reflect.UndeclaredThrowableException(new IOException( "Connection refuced1"))).thenThrow( new java.lang.reflect.UndeclaredThrowableException(new IOException( "Connection refuced2"))) .thenReturn(getFinishedApplicationReport()); ClientServiceDelegate clientServiceDelegate = new ClientServiceDelegate( conf, rmDelegate, oldJobId, historyServerProxy); JobStatus jobStatus = clientServiceDelegate.getJobStatus(oldJobId); verify(rmDelegate, times(3)).getApplicationReport( any(ApplicationId.class)); Assert.assertNotNull(jobStatus); } catch (YarnException e) { throw new IOException(e); } }
@Test public void testRemoteExceptionFromHistoryServer() throws Exception { MRClientProtocol historyServerProxy = mock(MRClientProtocol.class); when(historyServerProxy.getJobReport(getJobReportRequest())).thenThrow( new IOException("Job ID doesnot Exist")); ResourceMgrDelegate rm = mock(ResourceMgrDelegate.class); when(rm.getApplicationReport(TypeConverter.toYarn(oldJobId).getAppId())) .thenReturn(null); ClientServiceDelegate clientServiceDelegate = getClientServiceDelegate( historyServerProxy, rm); try { clientServiceDelegate.getJobStatus(oldJobId); Assert.fail("Invoke should throw exception after retries."); } catch (IOException e) { Assert.assertTrue(e.getMessage().contains( "Job ID doesnot Exist")); } }
@Test public void testUnknownAppInRM() throws Exception { MRClientProtocol historyServerProxy = mock(MRClientProtocol.class); when(historyServerProxy.getJobReport(getJobReportRequest())).thenReturn( getJobReportResponse()); ClientServiceDelegate clientServiceDelegate = getClientServiceDelegate( historyServerProxy, getRMDelegate()); JobStatus jobStatus = clientServiceDelegate.getJobStatus(oldJobId); Assert.assertNotNull(jobStatus); }
when(amProxy.getJobReport(any(GetJobReportRequest.class))) .thenThrow(new AuthorizationException("Denied")); Configuration conf = new YarnConfiguration(); MRJobConfig.DEFAULT_MR_CLIENT_MAX_RETRIES), clientServiceDelegate .getMaxClientRetry()); verify(amProxy, times(1)).getJobReport(any(GetJobReportRequest.class));
when(firstGenAMProxy.getJobReport(any(GetJobReportRequest.class))) .thenReturn(jobReportResponse1).thenThrow( new RuntimeException("AM is down!")); when(secondGenAMProxy.getJobReport(any(GetJobReportRequest.class))) .thenReturn(jobReportResponse2);
@Test public void testJobReportFromHistoryServer() throws Exception { MRClientProtocol historyServerProxy = mock(MRClientProtocol.class); when(historyServerProxy.getJobReport(getJobReportRequest())).thenReturn( getJobReportResponseFromHistoryServer()); ResourceMgrDelegate rm = mock(ResourceMgrDelegate.class); when(rm.getApplicationReport(TypeConverter.toYarn(oldJobId).getAppId())) .thenReturn(null); ClientServiceDelegate clientServiceDelegate = getClientServiceDelegate( historyServerProxy, rm); JobStatus jobStatus = clientServiceDelegate.getJobStatus(oldJobId); Assert.assertNotNull(jobStatus); Assert.assertEquals("TestJobFilePath", jobStatus.getJobFile()); Assert.assertEquals("http://TestTrackingUrl", jobStatus.getTrackingUrl()); Assert.assertEquals(1.0f, jobStatus.getMapProgress(), 0.0f); Assert.assertEquals(1.0f, jobStatus.getReduceProgress(), 0.0f); }
jobReportRequest.setJobId(MRBuilderUtils.newJobId(123456, 1, 1)); try { clientUsingDT.getJobReport(jobReportRequest); } catch (IOException e) { Assert.assertEquals("Unknown job job_123456_0001", e.getMessage()); clientUsingDT.getJobReport(jobReportRequest); } catch (IOException e) { Assert.assertEquals("Unknown job job_123456_0001", e.getMessage()); clientUsingDT.getJobReport(jobReportRequest); fail("Should not have succeeded with an expired token"); } catch (IOException e) { clientUsingDT.getJobReport(jobReportRequest); } catch (IOException e) { fail("Unexpected exception" + e); clientUsingDT.getJobReport(jobReportRequest); fail("Should not have succeeded with a cancelled delegation token"); } catch (IOException e) {
when(historyServerProxy.getJobReport(getJobReportRequest())).thenReturn( getJobReportResponseFromHistoryServer());
recordFactory.newRecordInstance(GetJobReportRequest.class); gjrRequest.setJobId(job.getID()); JobReport jr = proxy.getJobReport(gjrRequest).getJobReport(); verifyJobReport(jr);