Search in sources :

Example 36 with YarnException

use of org.apache.hadoop.yarn.exceptions.YarnException in project hadoop by apache.

the class TestReservationInputValidator method testListReservationsInvalidTimeIntervalDefaults.

@Test
public void testListReservationsInvalidTimeIntervalDefaults() {
    ReservationListRequest request = new ReservationListRequestPBImpl();
    request.setQueue(ReservationSystemTestUtil.reservationQ);
    // Negative time gets converted to default values for Start Time and End
    // Time which are 0 and Long.MAX_VALUE respectively.
    request.setEndTime(-2);
    request.setStartTime(-1);
    when(rSystem.getPlan(ReservationSystemTestUtil.reservationQ)).thenReturn(this.plan);
    Plan plan = null;
    try {
        plan = rrValidator.validateReservationListRequest(rSystem, request);
    } catch (YarnException e) {
        Assert.fail(e.getMessage());
    }
    Assert.assertNotNull(plan);
}
Also used : ReservationListRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationListRequest) ReservationListRequestPBImpl(org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationListRequestPBImpl) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) Test(org.junit.Test)

Example 37 with YarnException

use of org.apache.hadoop.yarn.exceptions.YarnException in project hadoop by apache.

the class TestReservationInputValidator method testSubmitReservationInvalidDeadline.

@Test
public void testSubmitReservationInvalidDeadline() {
    ReservationSubmissionRequest request = createSimpleReservationSubmissionRequest(1, 1, 1, 0, 3);
    Plan plan = null;
    try {
        plan = rrValidator.validateReservationSubmissionRequest(rSystem, request, ReservationSystemTestUtil.getNewReservationId());
        Assert.fail();
    } catch (YarnException e) {
        Assert.assertNull(plan);
        String message = e.getMessage();
        Assert.assertTrue(message.startsWith("The specified deadline: 0 is the past"));
        LOG.info(message);
    }
}
Also used : ReservationSubmissionRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) Test(org.junit.Test)

Example 38 with YarnException

use of org.apache.hadoop.yarn.exceptions.YarnException in project hadoop by apache.

the class TestReservationInputValidator method testUpdateReservationExceedsGangSize.

@Test
public void testUpdateReservationExceedsGangSize() {
    ReservationUpdateRequest request = createSimpleReservationUpdateRequest(1, 1, 1, 5, 4);
    Resource resource = Resource.newInstance(512, 1);
    when(plan.getTotalCapacity()).thenReturn(resource);
    Plan plan = null;
    try {
        plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
        Assert.fail();
    } catch (YarnException e) {
        Assert.assertNull(plan);
        String message = e.getMessage();
        Assert.assertTrue(message.startsWith("The size of the largest gang in the reservation definition"));
        Assert.assertTrue(message.contains("exceed the capacity available "));
        LOG.info(message);
    }
}
Also used : ReservationUpdateRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateRequest) Resource(org.apache.hadoop.yarn.api.records.Resource) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) Test(org.junit.Test)

Example 39 with YarnException

use of org.apache.hadoop.yarn.exceptions.YarnException in project hadoop by apache.

the class TestReservationInputValidator method testListReservationsNullPlan.

@Test
public void testListReservationsNullPlan() {
    ReservationListRequest request = new ReservationListRequestPBImpl();
    request.setQueue(ReservationSystemTestUtil.reservationQ);
    when(rSystem.getPlan(ReservationSystemTestUtil.reservationQ)).thenReturn(null);
    Plan plan = null;
    try {
        plan = rrValidator.validateReservationListRequest(rSystem, request);
        Assert.fail();
    } catch (YarnException e) {
        Assert.assertNull(plan);
        String message = e.getMessage();
        Assert.assertTrue(message.equals("The specified queue: " + ReservationSystemTestUtil.reservationQ + " is not managed by reservation system." + " Please try again with a valid reservable queue."));
        LOG.info(message);
    }
}
Also used : ReservationListRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationListRequest) ReservationListRequestPBImpl(org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationListRequestPBImpl) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) Test(org.junit.Test)

Example 40 with YarnException

use of org.apache.hadoop.yarn.exceptions.YarnException in project hadoop by apache.

the class TestReservationInputValidator method testListReservationsEmptyQueue.

@Test
public void testListReservationsEmptyQueue() {
    ReservationListRequest request = new ReservationListRequestPBImpl();
    request.setQueue("");
    Plan plan = null;
    try {
        plan = rrValidator.validateReservationListRequest(rSystem, request);
        Assert.fail();
    } catch (YarnException e) {
        Assert.assertNull(plan);
        String message = e.getMessage();
        Assert.assertTrue(message.equals("The queue is not specified. Please try again with a valid " + "reservable queue."));
        LOG.info(message);
    }
}
Also used : ReservationListRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationListRequest) ReservationListRequestPBImpl(org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationListRequestPBImpl) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) Test(org.junit.Test)

Aggregations

YarnException (org.apache.hadoop.yarn.exceptions.YarnException)287 IOException (java.io.IOException)149 Test (org.junit.Test)107 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)61 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)44 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)31 Configuration (org.apache.hadoop.conf.Configuration)26 ApplicationReport (org.apache.hadoop.yarn.api.records.ApplicationReport)26 ArrayList (java.util.ArrayList)25 ContainerId (org.apache.hadoop.yarn.api.records.ContainerId)25 ApplicationNotFoundException (org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException)25 AccessControlException (org.apache.hadoop.security.AccessControlException)22 RMApp (org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp)21 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)17 Path (org.apache.hadoop.fs.Path)17 ReservationSubmissionRequest (org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest)15 ContainerLaunchContext (org.apache.hadoop.yarn.api.records.ContainerLaunchContext)15 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)14 HashMap (java.util.HashMap)13 ApplicationSubmissionContext (org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext)13