Search in sources :

Example 1 with ReservationSubmissionRequestPBImpl

use of org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationSubmissionRequestPBImpl in project hadoop by apache.

the class TestReservationInputValidator method createSimpleReservationSubmissionRequest.

private ReservationSubmissionRequest createSimpleReservationSubmissionRequest(int numRequests, int numContainers, long arrival, long deadline, long duration, String recurrence) {
    // create a request with a single atomic ask
    ReservationSubmissionRequest request = new ReservationSubmissionRequestPBImpl();
    ReservationDefinition rDef = new ReservationDefinitionPBImpl();
    rDef.setArrival(arrival);
    rDef.setDeadline(deadline);
    rDef.setRecurrenceExpression(recurrence);
    if (numRequests > 0) {
        ReservationRequests reqs = new ReservationRequestsPBImpl();
        rDef.setReservationRequests(reqs);
        if (numContainers > 0) {
            ReservationRequest r = ReservationRequest.newInstance(Resource.newInstance(1024, 1), numContainers, 1, duration);
            reqs.setReservationResources(Collections.singletonList(r));
            reqs.setInterpreter(ReservationRequestInterpreter.R_ALL);
        }
    }
    request.setQueue(PLAN_NAME);
    request.setReservationDefinition(rDef);
    return request;
}
Also used : ReservationRequestsPBImpl(org.apache.hadoop.yarn.api.records.impl.pb.ReservationRequestsPBImpl) ReservationSubmissionRequestPBImpl(org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationSubmissionRequestPBImpl) ReservationDefinition(org.apache.hadoop.yarn.api.records.ReservationDefinition) ReservationRequest(org.apache.hadoop.yarn.api.records.ReservationRequest) ReservationDefinitionPBImpl(org.apache.hadoop.yarn.api.records.impl.pb.ReservationDefinitionPBImpl) ReservationRequests(org.apache.hadoop.yarn.api.records.ReservationRequests) ReservationSubmissionRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest)

Example 2 with ReservationSubmissionRequestPBImpl

use of org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationSubmissionRequestPBImpl in project hadoop by apache.

the class TestReservationInputValidator method testSubmitReservationNoDefinition.

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

Example 3 with ReservationSubmissionRequestPBImpl

use of org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationSubmissionRequestPBImpl in project hadoop by apache.

the class TestReservationInputValidator method testSubmitReservationDoesNotExist.

@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 is not specified. Please try again with a valid reservable queue."));
        LOG.info(message);
    }
}
Also used : ReservationSubmissionRequestPBImpl(org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationSubmissionRequestPBImpl) ReservationSubmissionRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) Test(org.junit.Test)

Aggregations

ReservationSubmissionRequest (org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest)3 ReservationSubmissionRequestPBImpl (org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationSubmissionRequestPBImpl)3 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)2 Test (org.junit.Test)2 ReservationDefinition (org.apache.hadoop.yarn.api.records.ReservationDefinition)1 ReservationRequest (org.apache.hadoop.yarn.api.records.ReservationRequest)1 ReservationRequests (org.apache.hadoop.yarn.api.records.ReservationRequests)1 ReservationDefinitionPBImpl (org.apache.hadoop.yarn.api.records.impl.pb.ReservationDefinitionPBImpl)1 ReservationRequestsPBImpl (org.apache.hadoop.yarn.api.records.impl.pb.ReservationRequestsPBImpl)1