use of org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest in project hadoop by apache.
the class TestReservationInputValidator method testDeleteReservationNoID.
@Test
public void testDeleteReservationNoID() {
ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
Plan plan = null;
try {
plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
Assert.fail();
} catch (YarnException e) {
Assert.assertNull(plan);
String message = e.getMessage();
Assert.assertTrue(message.startsWith("Missing reservation id. Please try again by specifying a reservation id."));
LOG.info(message);
}
}
use of org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest in project hadoop by apache.
the class TestReservationInputValidator method testDeleteReservationInvalidPlan.
@Test
public void testDeleteReservationInvalidPlan() {
ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
ReservationId reservationID = ReservationSystemTestUtil.getNewReservationId();
request.setReservationId(reservationID);
when(rSystem.getPlan(PLAN_NAME)).thenReturn(null);
Plan plan = null;
try {
plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
Assert.fail();
} catch (YarnException e) {
Assert.assertNull(plan);
String message = e.getMessage();
Assert.assertTrue(message.endsWith(" is not associated with any valid plan. Please try again with a valid reservation."));
LOG.info(message);
}
}
use of org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest in project hadoop by apache.
the class TestReservationInputValidator method testDeleteReservationDoesnotExist.
@Test
public void testDeleteReservationDoesnotExist() {
ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
ReservationId rId = ReservationSystemTestUtil.getNewReservationId();
request.setReservationId(rId);
when(rSystem.getQueueForReservation(rId)).thenReturn(null);
Plan plan = null;
try {
plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
Assert.fail();
} catch (YarnException e) {
Assert.assertNull(plan);
String message = e.getMessage();
Assert.assertTrue(message.equals(MessageFormat.format("The specified reservation with ID: {0} is unknown. Please try again with a valid reservation.", rId)));
LOG.info(message);
}
}
use of org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest in project hadoop by apache.
the class TestReservationSystemWithRMHA method testDeleteReservationAndCheckAfterFailover.
@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));
}
use of org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest in project hadoop by apache.
the class ReservationACLsTestBase method deleteReservation.
private void deleteReservation(String deleter, ReservationId id) throws Exception {
ApplicationClientProtocol deleteClient = getRMClientForUser(deleter);
final ReservationDeleteRequest deleteRequest = ReservationDeleteRequest.newInstance(id);
deleteClient.deleteReservation(deleteRequest);
}
Aggregations