本文整理汇总了Java中org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest.setQueues方法的典型用法代码示例。如果您正苦于以下问题:Java GetApplicationsRequest.setQueues方法的具体用法?Java GetApplicationsRequest.setQueues怎么用?Java GetApplicationsRequest.setQueues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest
的用法示例。
在下文中一共展示了GetApplicationsRequest.setQueues方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fetchAppReports
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest; //导入方法依赖的package包/类
protected List<ApplicationReport> fetchAppReports() throws YarnException,
IOException {
List<ApplicationReport> ret;
EnumSet<YarnApplicationState> states =
EnumSet.of(YarnApplicationState.ACCEPTED, YarnApplicationState.RUNNING);
GetApplicationsRequest req =
GetApplicationsRequest.newInstance(types, states);
req.setQueues(queues);
req.setUsers(users);
ret = applicationReportsCache.getIfPresent(req);
if (ret != null) {
return ret;
}
ret = client.getApplications(queues, users, types, states);
applicationReportsCache.put(req, ret);
return ret;
}
示例2: getApplications
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest; //导入方法依赖的package包/类
@Override
public List<ApplicationReport> getApplications(Set<String> queues,
Set<String> users, Set<String> applicationTypes,
EnumSet<YarnApplicationState> applicationStates) throws YarnException,
IOException {
GetApplicationsRequest request =
GetApplicationsRequest.newInstance(applicationTypes, applicationStates);
request.setQueues(queues);
request.setUsers(users);
GetApplicationsResponse response = rmClient.getApplications(request);
return response.getApplicationList();
}
示例3: testGetApplicationsRequest
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest; //导入方法依赖的package包/类
@Test
public void testGetApplicationsRequest(){
GetApplicationsRequest request = GetApplicationsRequest.newInstance();
EnumSet<YarnApplicationState> appStates =
EnumSet.of(YarnApplicationState.ACCEPTED);
request.setApplicationStates(appStates);
Set<String> tags = new HashSet<String>();
tags.add("tag1");
request.setApplicationTags(tags);
Set<String> types = new HashSet<String>();
types.add("type1");
request.setApplicationTypes(types);
long startBegin = System.currentTimeMillis();
long startEnd = System.currentTimeMillis() + 1;
request.setStartRange(startBegin, startEnd);
long finishBegin = System.currentTimeMillis() + 2;
long finishEnd = System.currentTimeMillis() + 3;
request.setFinishRange(finishBegin, finishEnd);
long limit = 100L;
request.setLimit(limit);
Set<String> queues = new HashSet<String>();
queues.add("queue1");
request.setQueues(queues);
Set<String> users = new HashSet<String>();
users.add("user1");
request.setUsers(users);
ApplicationsRequestScope scope = ApplicationsRequestScope.ALL;
request.setScope(scope);
GetApplicationsRequest requestFromProto = new GetApplicationsRequestPBImpl(
((GetApplicationsRequestPBImpl)request).getProto());
// verify the whole record equals with original record
Assert.assertEquals(requestFromProto, request);
// verify all properties are the same as original request
Assert.assertEquals(
"ApplicationStates from proto is not the same with original request",
requestFromProto.getApplicationStates(), appStates);
Assert.assertEquals(
"ApplicationTags from proto is not the same with original request",
requestFromProto.getApplicationTags(), tags);
Assert.assertEquals(
"ApplicationTypes from proto is not the same with original request",
requestFromProto.getApplicationTypes(), types);
Assert.assertEquals(
"StartRange from proto is not the same with original request",
requestFromProto.getStartRange(), new LongRange(startBegin, startEnd));
Assert.assertEquals(
"FinishRange from proto is not the same with original request",
requestFromProto.getFinishRange(), new LongRange(finishBegin, finishEnd));
Assert.assertEquals(
"Limit from proto is not the same with original request",
requestFromProto.getLimit(), limit);
Assert.assertEquals(
"Queues from proto is not the same with original request",
requestFromProto.getQueues(), queues);
Assert.assertEquals(
"Users from proto is not the same with original request",
requestFromProto.getUsers(), users);
}