Search in sources :

Example 6 with ReservationDeleteRequest

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);
    }
}
Also used : ReservationDeleteRequestPBImpl(org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationDeleteRequestPBImpl) ReservationDeleteRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) Test(org.junit.Test)

Example 7 with ReservationDeleteRequest

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);
    }
}
Also used : ReservationDeleteRequestPBImpl(org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationDeleteRequestPBImpl) ReservationId(org.apache.hadoop.yarn.api.records.ReservationId) ReservationDeleteRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) Test(org.junit.Test)

Example 8 with ReservationDeleteRequest

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);
    }
}
Also used : ReservationDeleteRequestPBImpl(org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationDeleteRequestPBImpl) ReservationId(org.apache.hadoop.yarn.api.records.ReservationId) ReservationDeleteRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) Test(org.junit.Test)

Example 9 with ReservationDeleteRequest

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));
}
Also used : ReservationId(org.apache.hadoop.yarn.api.records.ReservationId) ReservationSubmissionRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest) ReservationDeleteRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest) ReservationSubmissionResponse(org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse) RMState(org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore.RMState) Test(org.junit.Test)

Example 10 with ReservationDeleteRequest

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);
}
Also used : ReservationDeleteRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest) ApplicationClientProtocol(org.apache.hadoop.yarn.api.ApplicationClientProtocol)

Aggregations

ReservationDeleteRequest (org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest)11 Test (org.junit.Test)9 ReservationId (org.apache.hadoop.yarn.api.records.ReservationId)8 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)6 ReservationSubmissionRequest (org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest)5 ReservationDeleteResponse (org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteResponse)4 ReservationDeleteRequestPBImpl (org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationDeleteRequestPBImpl)4 ReservationSubmissionResponse (org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse)3 ReservationListRequest (org.apache.hadoop.yarn.api.protocolrecords.ReservationListRequest)2 ReservationListResponse (org.apache.hadoop.yarn.api.protocolrecords.ReservationListResponse)2 ReservationDefinition (org.apache.hadoop.yarn.api.records.ReservationDefinition)2 Plan (org.apache.hadoop.yarn.server.resourcemanager.reservation.Plan)2 Clock (org.apache.hadoop.yarn.util.Clock)2 UTCClock (org.apache.hadoop.yarn.util.UTCClock)2 IOException (java.io.IOException)1 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)1 AccessControlException (java.security.AccessControlException)1 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)1 BrokenBarrierException (java.util.concurrent.BrokenBarrierException)1 Consumes (javax.ws.rs.Consumes)1