Java Code Examples for org.apache.hadoop.yarn.exceptions.YarnException#getMessage()

The following examples show how to use org.apache.hadoop.yarn.exceptions.YarnException#getMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestReservationInputValidator.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testUpdateReservationInvalidPlan() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 5, 4);
  when(rSystem.getPlan(PLAN_NAME)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(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);
  }
}
 
Example 2
Source File: TestReservationInputValidator.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubmitReservationInvalidRR() {
  ReservationSubmissionRequest request =
      createSimpleReservationSubmissionRequest(0, 0, 1, 5, 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("No resources have been specified to reserve"));
    LOG.info(message);
  }
}
 
Example 3
Source File: TestReservationInputValidator.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubmitReservationNoDefinition() {
  ReservationSubmissionRequest request =
      new ReservationSubmissionRequestPBImpl();
  request.setQueue(PLAN_NAME);
  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
            .equals("Missing reservation definition. Please try again by specifying a reservation definition."));
    LOG.info(message);
  }
}
 
Example 4
Source File: TestReservationInputValidator.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@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);
  }
}
 
Example 5
Source File: TestReservationInputValidator.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@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);
  }
}
 
Example 6
Source File: TestReservationInputValidator.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubmitReservationEmptyRR() {
  ReservationSubmissionRequest request =
      createSimpleReservationSubmissionRequest(1, 0, 1, 5, 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("No resources have been specified to reserve"));
    LOG.info(message);
  }
}
 
Example 7
Source File: TestReservationInputValidator.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testUpdateReservationInvalidDuration() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 3, 4);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .contains("must  be greater or equal to the minimum resource duration"));
    LOG.info(message);
  }
}
 
Example 8
Source File: TestReservationInputValidator.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testUpdateReservationEmptyRR() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 0, 1, 5, 3);
  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("No resources have been specified to reserve"));
    LOG.info(message);
  }
}
 
Example 9
Source File: TestReservationInputValidator.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testUpdateReservationNoID() {
  ReservationUpdateRequest request = new ReservationUpdateRequestPBImpl();
  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("Missing reservation id. Please try again by specifying a reservation id."));
    LOG.info(message);
  }
}
 
Example 10
Source File: TestReservationInputValidator.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testUpdateReservationInvalidDeadline() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 0, 3);
  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 specified deadline: 0 is the past"));
    LOG.info(message);
  }
}
 
Example 11
Source File: TestReservationInputValidator.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubmitReservationDoesnotExist() {
  ReservationSubmissionRequest request =
      new ReservationSubmissionRequestPBImpl();
  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
            .equals("The queue to submit is not specified. Please try again with a valid reservable queue."));
    LOG.info(message);
  }
}
 
Example 12
Source File: TestReservationInputValidator.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testUpdateReservationNoDefinition() {
  ReservationUpdateRequest request = new ReservationUpdateRequestPBImpl();
  request.setReservationId(ReservationSystemTestUtil.getNewReservationId());
  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("Missing reservation definition. Please try again by specifying a reservation definition."));
    LOG.info(message);
  }
}
 
Example 13
Source File: TestReservationInputValidator.java    From big-c with Apache License 2.0 6 votes vote down vote up
@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);
  }
}
 
Example 14
Source File: TestReservationInputValidator.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testUpdateReservationNoID() {
  ReservationUpdateRequest request = new ReservationUpdateRequestPBImpl();
  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("Missing reservation id. Please try again by specifying a reservation id."));
    LOG.info(message);
  }
}
 
Example 15
Source File: TestReservationInputValidator.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubmitReservationInvalidDuration() {
  ReservationSubmissionRequest request =
      createSimpleReservationSubmissionRequest(1, 1, 1, 3, 4);
  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 time difference"));
    Assert
        .assertTrue(message
            .contains("must  be greater or equal to the minimum resource duration"));
    LOG.info(message);
  }
}
 
Example 16
Source File: TestReservationInputValidator.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubmitReservationEmptyRR() {
  ReservationSubmissionRequest request =
      createSimpleReservationSubmissionRequest(1, 0, 1, 5, 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("No resources have been specified to reserve"));
    LOG.info(message);
  }
}
 
Example 17
Source File: TestReservationInputValidator.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubmitReservationInvalidRR() {
  ReservationSubmissionRequest request =
      createSimpleReservationSubmissionRequest(0, 0, 1, 5, 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("No resources have been specified to reserve"));
    LOG.info(message);
  }
}
 
Example 18
Source File: TestReservationInputValidator.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@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);
  }
}
 
Example 19
Source File: TestReservationInputValidator.java    From big-c with Apache License 2.0 6 votes vote down vote up
@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);
  }
}
 
Example 20
Source File: TestReservationInputValidator.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testUpdateReservationInvalidDeadline() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 0, 3);
  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 specified deadline: 0 is the past"));
    LOG.info(message);
  }
}