本文整理汇总了Java中org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest类的典型用法代码示例。如果您正苦于以下问题:Java GetApplicationAttemptsRequest类的具体用法?Java GetApplicationAttemptsRequest怎么用?Java GetApplicationAttemptsRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GetApplicationAttemptsRequest类属于org.apache.hadoop.yarn.api.protocolrecords包,在下文中一共展示了GetApplicationAttemptsRequest类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testGetApplicationAttempts
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest; //导入依赖的package包/类
@Test
public void testGetApplicationAttempts() throws YarnException, IOException {
ClientRMService rmService = createRMService();
RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
GetApplicationAttemptsRequest request = recordFactory
.newRecordInstance(GetApplicationAttemptsRequest.class);
ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(
ApplicationId.newInstance(123456, 1), 1);
request.setApplicationId(ApplicationId.newInstance(123456, 1));
try {
GetApplicationAttemptsResponse response = rmService
.getApplicationAttempts(request);
Assert.assertEquals(1, response.getApplicationAttemptList().size());
Assert.assertEquals(attemptId, response.getApplicationAttemptList()
.get(0).getApplicationAttemptId());
} catch (ApplicationNotFoundException ex) {
Assert.fail(ex.getMessage());
}
}
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestClientRMService.java
示例2: testApplicationAttempts
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest; //导入依赖的package包/类
@Test
public void testApplicationAttempts() throws IOException, YarnException {
ApplicationId appId = ApplicationId.newInstance(0, 1);
ApplicationAttemptId appAttemptId =
ApplicationAttemptId.newInstance(appId, 1);
ApplicationAttemptId appAttemptId1 =
ApplicationAttemptId.newInstance(appId, 2);
GetApplicationAttemptsRequest request =
GetApplicationAttemptsRequest.newInstance(appId);
GetApplicationAttemptsResponse response =
clientService.getApplicationAttempts(request);
List<ApplicationAttemptReport> attemptReports =
response.getApplicationAttemptList();
Assert.assertNotNull(attemptReports);
Assert.assertEquals(appAttemptId, attemptReports.get(0)
.getApplicationAttemptId());
Assert.assertEquals(appAttemptId1, attemptReports.get(1)
.getApplicationAttemptId());
}
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:TestApplicationHistoryClientService.java
示例3: getApplicationAttempts
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest; //导入依赖的package包/类
@Override
public List<ApplicationAttemptReport> getApplicationAttempts(
ApplicationId appId) throws YarnException, IOException {
try {
GetApplicationAttemptsRequest request = Records
.newRecord(GetApplicationAttemptsRequest.class);
request.setApplicationId(appId);
GetApplicationAttemptsResponse response = rmClient
.getApplicationAttempts(request);
return response.getApplicationAttemptList();
} 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.getApplicationAttempts(appId);
}
}
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:YarnClientImpl.java
示例4: testApplicationAttempts
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest; //导入依赖的package包/类
@Test
public void testApplicationAttempts() throws IOException, YarnException {
ApplicationId appId = ApplicationId.newInstance(0, 1);
ApplicationAttemptId appAttemptId =
ApplicationAttemptId.newInstance(appId, 1);
ApplicationAttemptId appAttemptId1 =
ApplicationAttemptId.newInstance(appId, 2);
GetApplicationAttemptsRequest request =
GetApplicationAttemptsRequest.newInstance(appId);
GetApplicationAttemptsResponse response =
clientService.getClientHandler().getApplicationAttempts(request);
List<ApplicationAttemptReport> attemptReports =
response.getApplicationAttemptList();
Assert.assertNotNull(attemptReports);
Collections.sort(attemptReports, new Comparator<ApplicationAttemptReport>() {
@Override
public int compare(ApplicationAttemptReport o1, ApplicationAttemptReport o2) {
return o1.getApplicationAttemptId().compareTo(o2.getApplicationAttemptId());
}
});
Assert.assertEquals(appAttemptId, attemptReports.get(0)
.getApplicationAttemptId());
Assert.assertEquals(appAttemptId1, attemptReports.get(1)
.getApplicationAttemptId());
}
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:26,代码来源:TestApplicationHistoryClientService.java
示例5: testApplicationAttempts
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest; //导入依赖的package包/类
@Test
public void testApplicationAttempts() throws IOException, YarnException {
ApplicationId appId = ApplicationId.newInstance(0, 1);
ApplicationAttemptId appAttemptId =
ApplicationAttemptId.newInstance(appId, 1);
ApplicationAttemptId appAttemptId1 =
ApplicationAttemptId.newInstance(appId, 2);
writeApplicationAttemptStartData(appAttemptId);
writeApplicationAttemptFinishData(appAttemptId);
writeApplicationAttemptStartData(appAttemptId1);
writeApplicationAttemptFinishData(appAttemptId1);
GetApplicationAttemptsRequest request =
GetApplicationAttemptsRequest.newInstance(appId);
GetApplicationAttemptsResponse response =
historyServer.getClientService().getClientHandler()
.getApplicationAttempts(request);
List<ApplicationAttemptReport> attemptReports =
response.getApplicationAttemptList();
Assert.assertNotNull(attemptReports);
Assert.assertEquals(appAttemptId, attemptReports.get(0)
.getApplicationAttemptId());
Assert.assertEquals(appAttemptId1, attemptReports.get(1)
.getApplicationAttemptId());
}
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:25,代码来源:TestApplicationHistoryClientService.java
示例6: getApplicationAttempts
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest; //导入依赖的package包/类
@Override
public GetApplicationAttemptsResponse getApplicationAttempts(
GetApplicationAttemptsRequest request) throws YarnException, IOException {
GetApplicationAttemptsRequestProto requestProto =
((GetApplicationAttemptsRequestPBImpl) request).getProto();
try {
return new GetApplicationAttemptsResponsePBImpl(
proxy.getApplicationAttempts(null, requestProto));
} catch (ServiceException e) {
RPCUtil.unwrapAndThrowException(e);
return null;
}
}
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:ApplicationHistoryProtocolPBClientImpl.java
示例7: getApplicationAttempts
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest; //导入依赖的package包/类
@Override
public GetApplicationAttemptsResponse getApplicationAttempts(
GetApplicationAttemptsRequest request) throws YarnException, IOException {
ApplicationId appId = 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(appId);
if (application == null) {
// If the RM doesn't have the application, throw
// ApplicationNotFoundException and let client to handle.
throw new ApplicationNotFoundException("Application with id '" + appId
+ "' doesn't exist in RM.");
}
boolean allowAccess = checkAccess(callerUGI, application.getUser(),
ApplicationAccessType.VIEW_APP, application);
GetApplicationAttemptsResponse response = null;
if (allowAccess) {
Map<ApplicationAttemptId, RMAppAttempt> attempts = application
.getAppAttempts();
List<ApplicationAttemptReport> listAttempts =
new ArrayList<ApplicationAttemptReport>();
Iterator<Map.Entry<ApplicationAttemptId, RMAppAttempt>> iter = attempts
.entrySet().iterator();
while (iter.hasNext()) {
listAttempts.add(iter.next().getValue()
.createApplicationAttemptReport());
}
response = GetApplicationAttemptsResponse.newInstance(listAttempts);
} else {
throw new YarnException("User " + callerUGI.getShortUserName()
+ " does not have privilage to see this aplication " + appId);
}
return response;
}
开发者ID:naver,项目名称:hadoop,代码行数:40,代码来源:ClientRMService.java
示例8: getApplicationAttempts
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest; //导入依赖的package包/类
@Override
public GetApplicationAttemptsResponse getApplicationAttempts(
GetApplicationAttemptsRequest request) throws YarnException, IOException {
GetApplicationAttemptsResponse response =
GetApplicationAttemptsResponse
.newInstance(new ArrayList<ApplicationAttemptReport>(history
.getApplicationAttempts(request.getApplicationId()).values()));
return response;
}
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:ApplicationHistoryClientService.java
示例9: getApplicationAttempts
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest; //导入依赖的package包/类
@Override
public List<ApplicationAttemptReport> getApplicationAttempts(
ApplicationId appId) throws YarnException, IOException {
GetApplicationAttemptsRequest request = GetApplicationAttemptsRequest
.newInstance(appId);
GetApplicationAttemptsResponse response = ahsClient
.getApplicationAttempts(request);
return response.getApplicationAttemptList();
}
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:AHSClientImpl.java
示例10: getApplicationAttempts
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest; //导入依赖的package包/类
@Override
public GetApplicationAttemptsResponse getApplicationAttempts(
GetApplicationAttemptsRequest request) throws YarnException,
IOException {
resetStartFailoverFlag(true);
// make sure failover has been triggered
Assert.assertTrue(waittingForFailOver());
// return fake ApplicationAttemptReports
return GetApplicationAttemptsResponse
.newInstance(createFakeApplicationAttemptReports());
}
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:ProtocolHATestBase.java
示例11: getApplicationAttempts
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest; //导入依赖的package包/类
@Override
public GetApplicationAttemptsResponse getApplicationAttempts(
GetApplicationAttemptsRequest request) throws YarnException,
IOException {
GetApplicationAttemptsResponse response =
GetApplicationAttemptsResponse
.newInstance(new ArrayList<ApplicationAttemptReport>(history
.getApplicationAttempts(request.getApplicationId()).values()));
return response;
}
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:11,代码来源:ApplicationHistoryClientService.java
注:本文中的org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论