本文整理汇总了Java中org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse.getApplicationReport方法的典型用法代码示例。如果您正苦于以下问题:Java GetApplicationReportResponse.getApplicationReport方法的具体用法?Java GetApplicationReportResponse.getApplicationReport怎么用?Java GetApplicationReportResponse.getApplicationReport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse
的用法示例。
在下文中一共展示了GetApplicationReportResponse.getApplicationReport方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
示例2: 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();
}
示例3: 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());
}
示例4: 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();
}
示例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.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());
}
示例6: 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());
}
示例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);
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());
}
示例8: 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();
}
示例9: verifyAppReportAfterRMRestart
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
private ApplicationReport verifyAppReportAfterRMRestart(RMApp app, MockRM rm)
throws Exception {
GetApplicationReportRequest reportRequest =
GetApplicationReportRequest.newInstance(app.getApplicationId());
GetApplicationReportResponse response =
rm.getClientRMService().getApplicationReport(reportRequest);
ApplicationReport report = response.getApplicationReport();
Assert.assertEquals(app.getStartTime(), report.getStartTime());
Assert.assertEquals(app.getFinishTime(), report.getFinishTime());
Assert.assertEquals(app.createApplicationState(),
report.getYarnApplicationState());
Assert.assertTrue(1 == report.getProgress());
return response.getApplicationReport();
}
示例10: getApplicationReport
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
public ApplicationReport getApplicationReport(ApplicationId appId)
throws YarnException, IOException {
ApplicationClientProtocol client = getClientRMService();
GetApplicationReportResponse response =
client.getApplicationReport(GetApplicationReportRequest
.newInstance(appId));
return response.getApplicationReport();
}
示例11: testGetApplicationReport
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
@Test
public void testGetApplicationReport() throws Exception {
YarnScheduler yarnScheduler = mock(YarnScheduler.class);
RMContext rmContext = mock(RMContext.class);
mockRMContext(yarnScheduler, rmContext);
ApplicationId appId1 = getApplicationId(1);
ApplicationACLsManager mockAclsManager = mock(ApplicationACLsManager.class);
when(
mockAclsManager.checkAccess(UserGroupInformation.getCurrentUser(),
ApplicationAccessType.VIEW_APP, null, appId1)).thenReturn(true);
ClientRMService rmService = new ClientRMService(rmContext, yarnScheduler,
null, mockAclsManager, null, null);
try {
RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
GetApplicationReportRequest request = recordFactory
.newRecordInstance(GetApplicationReportRequest.class);
request.setApplicationId(appId1);
GetApplicationReportResponse response =
rmService.getApplicationReport(request);
ApplicationReport report = response.getApplicationReport();
ApplicationResourceUsageReport usageReport =
report.getApplicationResourceUsageReport();
Assert.assertEquals(10, usageReport.getMemorySeconds());
Assert.assertEquals(3, usageReport.getVcoreSeconds());
Assert.assertEquals(3, usageReport.getGcoreSeconds());
} finally {
rmService.close();
}
}
示例12: getApplicationReport
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
@Override
public ApplicationReport getApplicationReport(ApplicationId appId)
throws YarnException, IOException {
GetApplicationReportRequest request = GetApplicationReportRequest
.newInstance(appId);
GetApplicationReportResponse response = ahsClient
.getApplicationReport(request);
return response.getApplicationReport();
}
示例13: testGetApplicationReport
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
@Test
public void testGetApplicationReport() throws Exception {
YarnScheduler yarnScheduler = mock(YarnScheduler.class);
RMContext rmContext = mock(RMContext.class);
mockRMContext(yarnScheduler, rmContext);
ApplicationId appId1 = getApplicationId(1);
ApplicationACLsManager mockAclsManager = mock(ApplicationACLsManager.class);
when(
mockAclsManager.checkAccess(UserGroupInformation.getCurrentUser(),
ApplicationAccessType.VIEW_APP, null, appId1)).thenReturn(true);
ClientRMService rmService = new ClientRMService(rmContext, yarnScheduler,
null, mockAclsManager, null, null);
try {
RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
GetApplicationReportRequest request = recordFactory
.newRecordInstance(GetApplicationReportRequest.class);
request.setApplicationId(appId1);
GetApplicationReportResponse response =
rmService.getApplicationReport(request);
ApplicationReport report = response.getApplicationReport();
ApplicationResourceUsageReport usageReport =
report.getApplicationResourceUsageReport();
Assert.assertEquals(10, usageReport.getMemorySeconds());
Assert.assertEquals(3, usageReport.getVcoreSeconds());
} finally {
rmService.close();
}
}
示例14: getApplicationReport
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
@Override
public ApplicationReport getApplicationReport(ApplicationId appId)
throws YarnException, IOException {
GetApplicationReportRequest request =
Records.newRecord(GetApplicationReportRequest.class);
request.setApplicationId(appId);
GetApplicationReportResponse response =
rmClient.getApplicationReport(request);
return response.getApplicationReport();
}
示例15: testGetApplicationReport
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
@Test
public void testGetApplicationReport() throws Exception {
YarnScheduler yarnScheduler = mock(YarnScheduler.class);
RMContext rmContext = mock(RMContext.class);
mockRMContext(yarnScheduler, rmContext);
ApplicationId appId1 = getApplicationId(1);
ApplicationACLsManager mockAclsManager = mock(ApplicationACLsManager.class);
when(
mockAclsManager.checkAccess(UserGroupInformation.getCurrentUser(),
ApplicationAccessType.VIEW_APP, null, appId1)).thenReturn(true);
ClientRMService rmService = new ClientRMService(rmContext, yarnScheduler,
null, mockAclsManager, null, null);
try {
RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
GetApplicationReportRequest request = recordFactory
.newRecordInstance(GetApplicationReportRequest.class);
request.setApplicationId(appId1);
GetApplicationReportResponse response =
rmService.getApplicationReport(request);
ApplicationReport report = response.getApplicationReport();
ApplicationResourceUsageReport usageReport =
report.getApplicationResourceUsageReport();
Assert.assertEquals(10, usageReport.getMemorySeconds());
Assert.assertEquals(3, usageReport.getVcoreSeconds());
Assert.assertEquals("<Not set>", report.getAmNodeLabelExpression());
Assert.assertEquals("<Not set>", report.getAppNodeLabelExpression());
// if application has am node label set to blank
ApplicationId appId2 = getApplicationId(2);
when(mockAclsManager.checkAccess(UserGroupInformation.getCurrentUser(),
ApplicationAccessType.VIEW_APP, null, appId2)).thenReturn(true);
request.setApplicationId(appId2);
response = rmService.getApplicationReport(request);
report = response.getApplicationReport();
Assert.assertEquals(NodeLabel.DEFAULT_NODE_LABEL_PARTITION,
report.getAmNodeLabelExpression());
Assert.assertEquals(NodeLabel.NODE_LABEL_EXPRESSION_NOT_SET,
report.getAppNodeLabelExpression());
// if application has am node label set to blank
ApplicationId appId3 = getApplicationId(3);
when(mockAclsManager.checkAccess(UserGroupInformation.getCurrentUser(),
ApplicationAccessType.VIEW_APP, null, appId3)).thenReturn(true);
request.setApplicationId(appId3);
response = rmService.getApplicationReport(request);
report = response.getApplicationReport();
Assert.assertEquals("high-mem", report.getAmNodeLabelExpression());
Assert.assertEquals("high-mem", report.getAppNodeLabelExpression());
// if application id is null
GetApplicationReportRequest invalidRequest = recordFactory
.newRecordInstance(GetApplicationReportRequest.class);
invalidRequest.setApplicationId(null);
try {
rmService.getApplicationReport(invalidRequest);
} catch (YarnException e) {
// rmService should return a ApplicationNotFoundException
// when a null application id is provided
Assert.assertTrue(e instanceof ApplicationNotFoundException);
}
} finally {
rmService.close();
}
}