本文整理汇总了Java中org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse类的典型用法代码示例。如果您正苦于以下问题:Java ReservationSubmissionResponse类的具体用法?Java ReservationSubmissionResponse怎么用?Java ReservationSubmissionResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReservationSubmissionResponse类属于org.apache.hadoop.yarn.api.protocolrecords包,在下文中一共展示了ReservationSubmissionResponse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: submitReservation
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
@Override
public ReservationSubmissionResponse submitReservation(ReservationSubmissionRequest request)
throws YarnException, IOException {
ReservationSubmissionRequestProto requestProto =
((ReservationSubmissionRequestPBImpl) request).getProto();
try {
return new ReservationSubmissionResponsePBImpl(proxy.submitReservation(null,
requestProto));
} catch (ServiceException e) {
RPCUtil.unwrapAndThrowException(e);
return null;
}
}
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:ApplicationClientProtocolPBClientImpl.java
示例2: testSubmitReservationAndCheckAfterFailover
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
@Test
public void testSubmitReservationAndCheckAfterFailover() throws Exception {
startRMs();
addNodeCapacityToPlan(rm1, 102400, 100);
ClientRMService clientService = rm1.getClientRMService();
// create a reservation
ReservationSubmissionRequest request = createReservationSubmissionRequest();
ReservationSubmissionResponse response = null;
try {
response = clientService.submitReservation(request);
} catch (Exception e) {
Assert.fail(e.getMessage());
}
Assert.assertNotNull(response);
ReservationId reservationID = response.getReservationId();
Assert.assertNotNull(reservationID);
LOG.info("Submit reservation response: " + reservationID);
// Do the failover
explicitFailover();
rm2.registerNode("127.0.0.1:1", 102400, 100);
RMState state = rm2.getRMContext().getStateStore().loadState();
Map<ReservationId, ReservationAllocationStateProto> reservationStateMap =
state.getReservationState().get(ReservationSystemTestUtil.reservationQ);
Assert.assertNotNull(reservationStateMap);
Assert.assertNotNull(reservationStateMap.get(reservationID));
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:33,代码来源:TestReservationSystemWithRMHA.java
示例3: testDeleteReservationAndCheckAfterFailover
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
@Test
public void testDeleteReservationAndCheckAfterFailover() throws Exception {
startRMs();
addNodeCapacityToPlan(rm1, 102400, 100);
ClientRMService clientService = rm1.getClientRMService();
// create a reservation
ReservationSubmissionRequest request = createReservationSubmissionRequest();
ReservationSubmissionResponse response = null;
try {
response = clientService.submitReservation(request);
} catch (Exception e) {
Assert.fail(e.getMessage());
}
Assert.assertNotNull(response);
ReservationId reservationID = response.getReservationId();
Assert.assertNotNull(reservationID);
// Delete the reservation
ReservationDeleteRequest deleteRequest =
ReservationDeleteRequest.newInstance(reservationID);
clientService.deleteReservation(deleteRequest);
// Do the failover
explicitFailover();
rm2.registerNode("127.0.0.1:1", 102400, 100);
RMState state = rm2.getRMContext().getStateStore().loadState();
Assert.assertNull(state.getReservationState()
.get(ReservationSystemTestUtil.reservationQ));
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:35,代码来源:TestReservationSystemWithRMHA.java
示例4: testFailoverAndSubmitReservation
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
@Test
public void testFailoverAndSubmitReservation() throws Exception {
startRMs();
addNodeCapacityToPlan(rm1, 102400, 100);
// Do the failover
explicitFailover();
addNodeCapacityToPlan(rm2, 102400, 100);
// create a reservation
ClientRMService clientService = rm2.getClientRMService();
ReservationSubmissionRequest request = createReservationSubmissionRequest();
ReservationSubmissionResponse response = null;
try {
response = clientService.submitReservation(request);
} catch (Exception e) {
Assert.fail(e.getMessage());
}
Assert.assertNotNull(response);
ReservationId reservationID = response.getReservationId();
Assert.assertNotNull(reservationID);
LOG.info("Submit reservation response: " + reservationID);
ReservationDefinition reservationDefinition =
request.getReservationDefinition();
// check if reservation is submitted successfully
Plan plan = rm2.getRMContext().getReservationSystem()
.getPlan(ReservationSystemTestUtil.reservationQ);
validateReservation(plan, reservationID, reservationDefinition);
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:33,代码来源:TestReservationSystemWithRMHA.java
示例5: testSubmitReservationAndCheckAfterFailover
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
@Test
public void testSubmitReservationAndCheckAfterFailover() throws Exception {
startRMs();
addNodeCapacityToPlan(rm1, 102400, 100);
ClientRMService clientService = rm1.getClientRMService();
ReservationId reservationID = getNewReservation(clientService)
.getReservationId();
// create a reservation
ReservationSubmissionRequest request = createReservationSubmissionRequest(
reservationID);
ReservationSubmissionResponse response = null;
try {
response = clientService.submitReservation(request);
} catch (Exception e) {
Assert.fail(e.getMessage());
}
Assert.assertNotNull(response);
Assert.assertNotNull(reservationID);
LOG.info("Submit reservation response: " + reservationID);
// Do the failover
explicitFailover();
rm2.registerNode("127.0.0.1:1", 102400, 100);
RMState state = rm2.getRMContext().getStateStore().loadState();
Map<ReservationId, ReservationAllocationStateProto> reservationStateMap =
state.getReservationState().get(ReservationSystemTestUtil.reservationQ);
Assert.assertNotNull(reservationStateMap);
Assert.assertNotNull(reservationStateMap.get(reservationID));
}
开发者ID:hopshadoop,项目名称:hops,代码行数:35,代码来源:TestReservationSystemWithRMHA.java
示例6: testDeleteReservationAndCheckAfterFailover
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
@Test
public void testDeleteReservationAndCheckAfterFailover() throws Exception {
startRMs();
addNodeCapacityToPlan(rm1, 102400, 100);
ClientRMService clientService = rm1.getClientRMService();
ReservationId reservationID = getNewReservation(clientService)
.getReservationId();
// create a reservation
ReservationSubmissionRequest request = createReservationSubmissionRequest(
reservationID);
ReservationSubmissionResponse response = null;
try {
response = clientService.submitReservation(request);
} catch (Exception e) {
Assert.fail(e.getMessage());
}
Assert.assertNotNull(response);
Assert.assertNotNull(reservationID);
// Delete the reservation
ReservationDeleteRequest deleteRequest =
ReservationDeleteRequest.newInstance(reservationID);
clientService.deleteReservation(deleteRequest);
// Do the failover
explicitFailover();
rm2.registerNode("127.0.0.1:1", 102400, 100);
RMState state = rm2.getRMContext().getStateStore().loadState();
Assert.assertNull(state.getReservationState()
.get(ReservationSystemTestUtil.reservationQ));
}
开发者ID:hopshadoop,项目名称:hops,代码行数:38,代码来源:TestReservationSystemWithRMHA.java
示例7: testFailoverAndSubmitReservation
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
@Test
public void testFailoverAndSubmitReservation() throws Exception {
startRMs();
addNodeCapacityToPlan(rm1, 102400, 100);
// Do the failover
explicitFailover();
addNodeCapacityToPlan(rm2, 102400, 100);
ClientRMService clientService = rm2.getClientRMService();
ReservationId reservationID = getNewReservation(clientService)
.getReservationId();
// create a reservation
ReservationSubmissionRequest request = createReservationSubmissionRequest(
reservationID);
ReservationSubmissionResponse response = null;
try {
response = clientService.submitReservation(request);
} catch (Exception e) {
Assert.fail(e.getMessage());
}
Assert.assertNotNull(response);
Assert.assertNotNull(reservationID);
LOG.info("Submit reservation response: " + reservationID);
ReservationDefinition reservationDefinition =
request.getReservationDefinition();
// check if reservation is submitted successfully
Plan plan = rm2.getRMContext().getReservationSystem()
.getPlan(ReservationSystemTestUtil.reservationQ);
validateReservation(plan, reservationID, reservationDefinition);
}
开发者ID:hopshadoop,项目名称:hops,代码行数:36,代码来源:TestReservationSystemWithRMHA.java
示例8: submitReservation
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
private void submitReservation(String submitter,
String queueName, ReservationId reservationId) throws Exception {
ApplicationClientProtocol submitterClient = getRMClientForUser(submitter);
ReservationSubmissionRequest reservationSubmissionRequest =
ReservationSubmissionRequest.newInstance(
makeSimpleReservationDefinition(), queueName, reservationId);
ReservationSubmissionResponse response = submitterClient
.submitReservation(reservationSubmissionRequest);
}
开发者ID:hopshadoop,项目名称:hops,代码行数:12,代码来源:ReservationACLsTestBase.java
示例9: submitReservationTestHelper
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
private ReservationSubmissionRequest submitReservationTestHelper(
YarnClient client, long arrival, long deadline, long duration)
throws IOException, YarnException {
ReservationId reservationID = client.createReservation().getReservationId();
ReservationSubmissionRequest sRequest = createSimpleReservationRequest(
reservationID, 4, arrival, deadline, duration);
ReservationSubmissionResponse sResponse =
client.submitReservation(sRequest);
Assert.assertNotNull(sResponse);
Assert.assertNotNull(reservationID);
System.out.println("Submit reservation response: " + reservationID);
return sRequest;
}
开发者ID:hopshadoop,项目名称:hops,代码行数:15,代码来源:TestYarnClient.java
示例10: submitReservation
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
@Override
public ReservationSubmissionResponse submitReservation(
ReservationSubmissionRequest request) throws YarnException, IOException {
// Check if reservation system is enabled
checkReservationSytem(AuditConstants.SUBMIT_RESERVATION_REQUEST);
ReservationSubmissionResponse response =
recordFactory.newRecordInstance(ReservationSubmissionResponse.class);
// Create a new Reservation Id
ReservationId reservationId = reservationSystem.getNewReservationId();
// Validate the input
Plan plan =
rValidator.validateReservationSubmissionRequest(reservationSystem,
request, reservationId);
// Check ACLs
String queueName = request.getQueue();
String user =
checkReservationACLs(queueName,
AuditConstants.SUBMIT_RESERVATION_REQUEST);
try {
// Try to place the reservation using the agent
boolean result =
plan.getReservationAgent().createReservation(reservationId, user,
plan, request.getReservationDefinition());
if (result) {
// add the reservation id to valid ones maintained by reservation
// system
reservationSystem.setQueueForReservation(reservationId, queueName);
// create the reservation synchronously if required
refreshScheduler(queueName, request.getReservationDefinition(),
reservationId.toString());
// return the reservation id
response.setReservationId(reservationId);
}
} catch (PlanningException e) {
RMAuditLogger.logFailure(user, AuditConstants.SUBMIT_RESERVATION_REQUEST,
e.getMessage(), "ClientRMService",
"Unable to create the reservation: " + reservationId);
throw RPCUtil.getRemoteException(e);
}
RMAuditLogger.logSuccess(user, AuditConstants.SUBMIT_RESERVATION_REQUEST,
"ClientRMService: " + reservationId);
return response;
}
开发者ID:naver,项目名称:hadoop,代码行数:44,代码来源:ClientRMService.java
示例11: submitReservation
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
@Override
public ReservationSubmissionResponse submitReservation(
ReservationSubmissionRequest request) throws YarnException, IOException {
return rmClient.submitReservation(request);
}
开发者ID:naver,项目名称:hadoop,代码行数:6,代码来源:YarnClientImpl.java
示例12: submitReservation
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
@Override
public ReservationSubmissionResponse submitReservation(
ReservationSubmissionRequest request) throws YarnException, IOException {
return client.submitReservation(request);
}
开发者ID:naver,项目名称:hadoop,代码行数:6,代码来源:ResourceMgrDelegate.java
示例13: submitReservation
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
@Override
public ReservationSubmissionResponse submitReservation(
ReservationSubmissionRequest request) throws YarnException, IOException {
return null;
}
开发者ID:naver,项目名称:hadoop,代码行数:6,代码来源:TestClientRedirect.java
示例14: submitReservation
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
@Override
public ReservationSubmissionResponse submitReservation(
ReservationSubmissionRequest arg0) throws YarnException, IOException {
// TODO Auto-generated method stub
return null;
}
开发者ID:intel-hpdd,项目名称:scheduling-connector-for-hadoop,代码行数:7,代码来源:HPCApplicationClientProtocolImpl.java
示例15: submitReservation
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
@Override
public ReservationSubmissionResponse submitReservation(
ReservationSubmissionRequest request) throws YarnException,
IOException {
throw new NotImplementedException();
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:7,代码来源:MockResourceManagerFacade.java
示例16: submitReservation
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
/**
* Function to submit a Reservation to the RM.
*
* @param resContext provides information to construct the
* ReservationSubmissionRequest
* @param hsr the servlet request
* @return Response containing the status code
* @throws AuthorizationException
* @throws IOException
* @throws InterruptedException
*/
@POST
@Path("/reservation/submit")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response submitReservation(
ReservationSubmissionRequestInfo resContext,
@Context HttpServletRequest hsr) throws AuthorizationException,
IOException, InterruptedException {
init();
UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
if (callerUGI == null) {
throw new AuthorizationException("Unable to obtain user name, "
+ "user not authenticated");
}
if (UserGroupInformation.isSecurityEnabled() && isStaticUser(callerUGI)) {
String msg = "The default static user cannot carry out this operation.";
return Response.status(Status.FORBIDDEN).entity(msg).build();
}
final ReservationSubmissionRequest reservation =
createReservationSubmissionRequest(resContext);
ReservationSubmissionResponseInfo resRespInfo;
try {
resRespInfo =
callerUGI.doAs(
new PrivilegedExceptionAction<ReservationSubmissionResponseInfo>() {
@Override
public ReservationSubmissionResponseInfo run()
throws IOException, YarnException {
ReservationSubmissionResponse tempRes =
rm.getClientRMService().submitReservation(reservation);
return new ReservationSubmissionResponseInfo(tempRes);
}
});
} catch (UndeclaredThrowableException ue) {
if (ue.getCause() instanceof YarnException) {
throw new BadRequestException(ue.getCause().getMessage());
}
LOG.info("Submit reservation request failed", ue);
throw ue;
}
return Response.status(Status.OK).entity(resRespInfo).build();
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:58,代码来源:RMWebServices.java
示例17: ReservationSubmissionResponseInfo
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
public ReservationSubmissionResponseInfo(
ReservationSubmissionResponse response) {
this.reservationId = response.getReservationId().toString();
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:5,代码来源:ReservationSubmissionResponseInfo.java
示例18: testUpdateReservationAndCheckAfterFailover
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
@Test
public void testUpdateReservationAndCheckAfterFailover() throws Exception {
startRMs();
addNodeCapacityToPlan(rm1, 102400, 100);
ClientRMService clientService = rm1.getClientRMService();
// create a reservation
ReservationSubmissionRequest request = createReservationSubmissionRequest();
ReservationSubmissionResponse response = null;
try {
response = clientService.submitReservation(request);
} catch (Exception e) {
Assert.fail(e.getMessage());
}
Assert.assertNotNull(response);
ReservationId reservationID = response.getReservationId();
Assert.assertNotNull(reservationID);
LOG.info("Submit reservation response: " + reservationID);
ReservationDefinition reservationDefinition =
request.getReservationDefinition();
// Change any field
long newDeadline = reservationDefinition.getDeadline() + 100;
reservationDefinition.setDeadline(newDeadline);
ReservationUpdateRequest updateRequest = ReservationUpdateRequest
.newInstance(reservationDefinition, reservationID);
rm1.updateReservationState(updateRequest);
// Do the failover
explicitFailover();
rm2.registerNode("127.0.0.1:1", 102400, 100);
RMState state = rm2.getRMContext().getStateStore().loadState();
Map<ReservationId, ReservationAllocationStateProto> reservationStateMap =
state.getReservationState().get(ReservationSystemTestUtil.reservationQ);
Assert.assertNotNull(reservationStateMap);
ReservationAllocationStateProto reservationState =
reservationStateMap.get(reservationID);
Assert.assertEquals(newDeadline,
reservationState.getReservationDefinition().getDeadline());
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:46,代码来源:TestReservationSystemWithRMHA.java
示例19: submitReservation
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
/**
* Function to submit a Reservation to the RM.
*
* @param resContext provides information to construct the
* ReservationSubmissionRequest
* @param hsr the servlet request
* @return Response containing the status code
* @throws AuthorizationException
* @throws IOException
* @throws InterruptedException
*/
@POST
@Path("/reservation/submit")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response submitReservation(
ReservationSubmissionRequestInfo resContext,
@Context HttpServletRequest hsr) throws AuthorizationException,
IOException, InterruptedException {
init();
UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
if (callerUGI == null) {
throw new AuthorizationException("Unable to obtain user name, "
+ "user not authenticated");
}
if (UserGroupInformation.isSecurityEnabled() && isStaticUser(callerUGI)) {
String msg = "The default static user cannot carry out this operation.";
return Response.status(Status.FORBIDDEN).entity(msg).build();
}
final ReservationSubmissionRequest reservation =
createReservationSubmissionRequest(resContext);
try {
callerUGI
.doAs(new PrivilegedExceptionAction<ReservationSubmissionResponse>() {
@Override
public ReservationSubmissionResponse run() throws IOException,
YarnException {
return rm.getClientRMService().submitReservation(reservation);
}
});
} catch (UndeclaredThrowableException ue) {
if (ue.getCause() instanceof YarnException) {
throw new BadRequestException(ue.getCause().getMessage());
}
LOG.info("Submit reservation request failed", ue);
throw ue;
}
return Response.status(Status.ACCEPTED).build();
}
开发者ID:hopshadoop,项目名称:hops,代码行数:54,代码来源:RMWebServices.java
示例20: submitReservation
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse; //导入依赖的package包/类
@Override
public ReservationSubmissionResponse submitReservation(
ReservationSubmissionRequest request) throws YarnException, IOException {
// Check if reservation system is enabled
checkReservationSytem(AuditConstants.SUBMIT_RESERVATION_REQUEST);
ReservationSubmissionResponse response =
recordFactory.newRecordInstance(ReservationSubmissionResponse.class);
ReservationId reservationId = request.getReservationId();
// Validate the input
Plan plan =
rValidator.validateReservationSubmissionRequest(reservationSystem,
request, reservationId);
ReservationAllocation allocation = plan.getReservationById(reservationId);
if (allocation != null) {
boolean isNewDefinition = !allocation.getReservationDefinition().equals(
request.getReservationDefinition());
if (isNewDefinition) {
String message = "Reservation allocation already exists with the " +
"reservation id " + reservationId.toString() + ", but a different" +
" reservation definition was provided. Please try again with a " +
"new reservation id, or consider updating the reservation instead.";
throw RPCUtil.getRemoteException(message);
} else {
return response;
}
}
// Check ACLs
String queueName = request.getQueue();
String user =
checkReservationACLs(queueName,
AuditConstants.SUBMIT_RESERVATION_REQUEST, null);
try {
// Try to place the reservation using the agent
boolean result =
plan.getReservationAgent().createReservation(reservationId, user,
plan, request.getReservationDefinition());
if (result) {
// add the reservation id to valid ones maintained by reservation
// system
reservationSystem.setQueueForReservation(reservationId, queueName);
// create the reservation synchronously if required
refreshScheduler(queueName, request.getReservationDefinition(),
reservationId.toString());
// return the reservation id
}
} catch (PlanningException e) {
RMAuditLogger.logFailure(user, AuditConstants.SUBMIT_RESERVATION_REQUEST,
e.getMessage(), "ClientRMService",
"Unable to create the reservation: " + reservationId);
throw RPCUtil.getRemoteException(e);
}
RMAuditLogger.logSuccess(user, AuditConstants.SUBMIT_RESERVATION_REQUEST,
"ClientRMService: " + reservationId);
return response;
}
开发者ID:hopshadoop,项目名称:hops,代码行数:59,代码来源:ClientRMService.java
注:本文中的org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论