本文整理汇总了Java中org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse类的典型用法代码示例。如果您正苦于以下问题:Java GetApplicationReportResponse类的具体用法?Java GetApplicationReportResponse怎么用?Java GetApplicationReportResponse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GetApplicationReportResponse类属于org.apache.hadoop.yarn.api.protocolrecords包,在下文中一共展示了GetApplicationReportResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyGetClientAMToken
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入依赖的package包/类
private void verifyGetClientAMToken(String submitter, String queueAdmin,
String queueName, boolean setupACLs) throws Exception {
ApplicationId applicationId =
submitAppAndGetAppId(submitter, queueName, setupACLs);
final GetApplicationReportRequest appReportRequest =
GetApplicationReportRequest.newInstance(applicationId);
ApplicationClientProtocol submitterClient = getRMClientForUser(submitter);
ApplicationClientProtocol adMinUserClient = getRMClientForUser(queueAdmin);
GetApplicationReportResponse submitterGetReport =
submitterClient.getApplicationReport(appReportRequest);
GetApplicationReportResponse adMinUserGetReport =
adMinUserClient.getApplicationReport(appReportRequest);
Assert.assertEquals(submitterGetReport.getApplicationReport()
.getClientToAMToken(), adMinUserGetReport.getApplicationReport()
.getClientToAMToken());
}
示例2: testApplicationReport
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入依赖的package包/类
@Test
public void testApplicationReport() throws IOException, YarnException {
ApplicationId appId = null;
appId = ApplicationId.newInstance(0, 1);
GetApplicationReportRequest request =
GetApplicationReportRequest.newInstance(appId);
GetApplicationReportResponse response =
clientService.getApplicationReport(request);
ApplicationReport appReport = response.getApplicationReport();
Assert.assertNotNull(appReport);
Assert.assertEquals(123, appReport.getApplicationResourceUsageReport()
.getMemorySeconds());
Assert.assertEquals(345, appReport.getApplicationResourceUsageReport()
.getVcoreSeconds());
Assert.assertEquals(345, appReport.getApplicationResourceUsageReport()
.getGcoreSeconds());
Assert.assertEquals("application_0_0001", appReport.getApplicationId()
.toString());
Assert.assertEquals("test app type",
appReport.getApplicationType().toString());
Assert.assertEquals("test queue", appReport.getQueue().toString());
}
示例3: getApplicationReport
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入依赖的package包/类
@Override
public ApplicationReport getApplicationReport(ApplicationId appId)
throws YarnException, IOException {
GetApplicationReportResponse response = null;
try {
GetApplicationReportRequest request = Records
.newRecord(GetApplicationReportRequest.class);
request.setApplicationId(appId);
response = rmClient.getApplicationReport(request);
} catch (YarnException e) {
if (!historyServiceEnabled) {
// Just throw it as usual if historyService is not enabled.
throw e;
}
// Even if history-service is enabled, treat all exceptions still the same
// except the following
if (!(e.getClass() == ApplicationNotFoundException.class)) {
throw e;
}
return historyClient.getApplicationReport(appId);
}
return response.getApplicationReport();
}
示例4: getAHSProxy
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入依赖的package包/类
@Override
protected ApplicationHistoryProtocol getAHSProxy(Configuration conf)
throws IOException
{
GetApplicationReportResponse resp = Mockito.
mock(GetApplicationReportResponse.class);
historyManager = Mockito.mock(ApplicationHistoryProtocol.class);
try {
Mockito.when(historyManager.getApplicationReport(Mockito
.any(GetApplicationReportRequest.class))).thenReturn(resp);
} catch (YarnException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return historyManager;
}
示例5: testApplicationReport
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入依赖的package包/类
@Test
public void testApplicationReport() throws IOException, YarnException {
ApplicationId appId = null;
appId = ApplicationId.newInstance(0, 1);
GetApplicationReportRequest request =
GetApplicationReportRequest.newInstance(appId);
GetApplicationReportResponse response =
clientService.getApplicationReport(request);
ApplicationReport appReport = response.getApplicationReport();
Assert.assertNotNull(appReport);
Assert.assertEquals(123, appReport.getApplicationResourceUsageReport()
.getMemorySeconds());
Assert.assertEquals(345, appReport.getApplicationResourceUsageReport()
.getVcoreSeconds());
Assert.assertEquals("application_0_0001", appReport.getApplicationId()
.toString());
Assert.assertEquals("test app type",
appReport.getApplicationType().toString());
Assert.assertEquals("test queue", appReport.getQueue().toString());
}
示例6: getApplicationReport
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入依赖的package包/类
@Override
public ApplicationReport getApplicationReport(ApplicationId appId)
throws YarnException, IOException {
GetApplicationReportResponse response = null;
try {
GetApplicationReportRequest request = Records
.newRecord(GetApplicationReportRequest.class);
request.setApplicationId(appId);
response = rmClient.getApplicationReport(request);
} catch (ApplicationNotFoundException e) {
if (!historyServiceEnabled) {
// Just throw it as usual if historyService is not enabled.
throw e;
}
return historyClient.getApplicationReport(appId);
}
return response.getApplicationReport();
}
示例7: testApplicationReport
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入依赖的package包/类
@Test
public void testApplicationReport() throws IOException, YarnException {
ApplicationId appId = null;
appId = ApplicationId.newInstance(0, 1);
GetApplicationReportRequest request =
GetApplicationReportRequest.newInstance(appId);
GetApplicationReportResponse response =
clientService.getClientHandler().getApplicationReport(request);
ApplicationReport appReport = response.getApplicationReport();
Assert.assertNotNull(appReport);
Assert.assertEquals("application_0_0001", appReport.getApplicationId()
.toString());
Assert.assertEquals("test app type",
appReport.getApplicationType().toString());
Assert.assertEquals("test queue", appReport.getQueue().toString());
}
示例8: testApplicationReport
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入依赖的package包/类
@Test
public void testApplicationReport() throws IOException, YarnException {
ApplicationId appId = null;
appId = ApplicationId.newInstance(0, 1);
GetApplicationReportRequest request =
GetApplicationReportRequest.newInstance(appId);
GetApplicationReportResponse response =
clientService.getApplicationReport(request);
ApplicationReport appReport = response.getApplicationReport();
Assert.assertNotNull(appReport);
Assert.assertEquals(123, appReport.getApplicationResourceUsageReport()
.getMemorySeconds());
Assert.assertEquals(345, appReport.getApplicationResourceUsageReport()
.getVcoreSeconds());
Assert.assertEquals(345, appReport.getApplicationResourceUsageReport()
.getGPUSeconds());
Assert.assertEquals("application_0_0001", appReport.getApplicationId()
.toString());
Assert.assertEquals("test app type",
appReport.getApplicationType().toString());
Assert.assertEquals("test queue", appReport.getQueue().toString());
}
示例9: testApplicationReport
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入依赖的package包/类
@Test
public void testApplicationReport() throws IOException, YarnException {
ApplicationId appId = null;
appId = ApplicationId.newInstance(0, 1);
writeApplicationStartData(appId);
writeApplicationFinishData(appId);
GetApplicationReportRequest request =
GetApplicationReportRequest.newInstance(appId);
GetApplicationReportResponse response =
historyServer.getClientService().getClientHandler()
.getApplicationReport(request);
ApplicationReport appReport = response.getApplicationReport();
Assert.assertNotNull(appReport);
Assert.assertEquals("application_0_0001", appReport.getApplicationId()
.toString());
Assert.assertEquals("test type", appReport.getApplicationType().toString());
Assert.assertEquals("test queue", appReport.getQueue().toString());
}
示例10: getApplicationReport
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入依赖的package包/类
@Override
public GetApplicationReportResponse getApplicationReport(
GetApplicationReportRequest request) throws YarnException, IOException {
GetApplicationReportRequestProto requestProto =
((GetApplicationReportRequestPBImpl) request).getProto();
try {
return new GetApplicationReportResponsePBImpl(proxy.getApplicationReport(
null, requestProto));
} catch (ServiceException e) {
RPCUtil.unwrapAndThrowException(e);
return null;
}
}
示例11: getApplicationReport
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入依赖的package包/类
@Override
public GetApplicationReportResponse getApplicationReport(
GetApplicationReportRequest request) throws YarnException,
IOException {
GetApplicationReportRequestProto requestProto =
((GetApplicationReportRequestPBImpl) request).getProto();
try {
return new GetApplicationReportResponsePBImpl(proxy.getApplicationReport(
null, requestProto));
} catch (ServiceException e) {
RPCUtil.unwrapAndThrowException(e);
return null;
}
}
示例12: createApplicationReportWithRunningApplication
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入依赖的package包/类
private static GetApplicationReportResponse
createApplicationReportWithRunningApplication() {
ApplicationReport report = mock(ApplicationReport.class);
when(report.getYarnApplicationState()).thenReturn(
YarnApplicationState.RUNNING);
GetApplicationReportResponse response =
mock(GetApplicationReportResponse.class);
when(response.getApplicationReport()).thenReturn(report);
return response;
}
示例13: createApplicationReportWithFinishedApplication
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入依赖的package包/类
private static GetApplicationReportResponse
createApplicationReportWithFinishedApplication() {
ApplicationReport report = mock(ApplicationReport.class);
when(report.getYarnApplicationState()).thenReturn(
YarnApplicationState.FINISHED);
GetApplicationReportResponse response =
mock(GetApplicationReportResponse.class);
when(response.getApplicationReport()).thenReturn(report);
return response;
}
示例14: getApplicationReport
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入依赖的package包/类
/**
* Get a report for the specified app.
* @param appId the id of the application to get.
* @return the ApplicationReport for that app.
* @throws YarnException on any error.
* @throws IOException
*/
public ApplicationReport getApplicationReport(ApplicationId appId)
throws YarnException, IOException {
GetApplicationReportRequest request = recordFactory
.newRecordInstance(GetApplicationReportRequest.class);
request.setApplicationId(appId);
GetApplicationReportResponse response = applicationsManager
.getApplicationReport(request);
return response.getApplicationReport();
}
示例15: getApplicationReport
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入依赖的package包/类
/**
* It gives response which includes application report if the application
* present otherwise throws ApplicationNotFoundException.
*/
@Override
public GetApplicationReportResponse getApplicationReport(
GetApplicationReportRequest request) throws YarnException {
ApplicationId applicationId = request.getApplicationId();
UserGroupInformation callerUGI;
try {
callerUGI = UserGroupInformation.getCurrentUser();
} catch (IOException ie) {
LOG.info("Error getting UGI ", ie);
throw RPCUtil.getRemoteException(ie);
}
RMApp application = this.rmContext.getRMApps().get(applicationId);
if (application == null) {
// If the RM doesn't have the application, throw
// ApplicationNotFoundException and let client to handle.
throw new ApplicationNotFoundException("Application with id '"
+ applicationId + "' doesn't exist in RM.");
}
boolean allowAccess = checkAccess(callerUGI, application.getUser(),
ApplicationAccessType.VIEW_APP, application);
ApplicationReport report =
application.createAndGetApplicationReport(callerUGI.getUserName(),
allowAccess);
GetApplicationReportResponse response = recordFactory
.newRecordInstance(GetApplicationReportResponse.class);
response.setApplicationReport(report);
return response;
}