use of org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse in project hadoop by apache.
the class TestReservationSystemWithRMHA method testSubmitReservationFailoverAndUpdate.
@Test
public void testSubmitReservationFailoverAndUpdate() 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);
ReservationDefinition reservationDefinition = request.getReservationDefinition();
// Do the failover
explicitFailover();
addNodeCapacityToPlan(rm2, 102400, 100);
// check if reservation exists after failover
Plan plan = rm2.getRMContext().getReservationSystem().getPlan(ReservationSystemTestUtil.reservationQ);
validateReservation(plan, reservationID, reservationDefinition);
// update the reservation
long newDeadline = reservationDefinition.getDeadline() + 100;
reservationDefinition.setDeadline(newDeadline);
ReservationUpdateRequest updateRequest = ReservationUpdateRequest.newInstance(reservationDefinition, reservationID);
ReservationUpdateResponse updateResponse = null;
clientService = rm2.getClientRMService();
try {
updateResponse = clientService.updateReservation(updateRequest);
} catch (Exception e) {
Assert.fail(e.getMessage());
}
Assert.assertNotNull(updateResponse);
validateReservation(plan, reservationID, reservationDefinition);
}
use of org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse in project hadoop by apache.
the class TestClientRMService method submitReservationTestHelper.
private ReservationSubmissionRequest submitReservationTestHelper(ClientRMService clientService, long arrival, long deadline, long duration) {
ReservationSubmissionResponse sResponse = null;
GetNewReservationRequest newReservationRequest = GetNewReservationRequest.newInstance();
ReservationId reservationID = null;
try {
reservationID = clientService.getNewReservation(newReservationRequest).getReservationId();
} catch (Exception e) {
Assert.fail(e.getMessage());
}
ReservationSubmissionRequest sRequest = ReservationSystemTestUtil.createSimpleReservationRequest(reservationID, 4, arrival, deadline, duration);
try {
sResponse = clientService.submitReservation(sRequest);
} catch (Exception e) {
Assert.fail(e.getMessage());
}
Assert.assertNotNull(sResponse);
Assert.assertNotNull(reservationID);
System.out.println("Submit reservation response: " + reservationID);
return sRequest;
}
use of org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse in project hadoop by apache.
the class TestYarnClient method submitReservationTestHelper.
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;
}
Aggregations