Search in sources :

Example 1 with GetNewReservationRequest

use of org.apache.hadoop.yarn.api.protocolrecords.GetNewReservationRequest in project hadoop by apache.

the class TestClientRMService method submitReservationTestHelper.

private ReservationSubmissionRequest submitReservationTestHelper(ClientRMService clientService, long arrival, long deadline, long duration) {
    ReservationSubmissionResponse sResponse = null;
    GetNewReservationRequest newReservationRequest = GetNewReservationRequest.newInstance();
    ReservationId reservationID = null;
    try {
        reservationID = clientService.getNewReservation(newReservationRequest).getReservationId();
    } catch (Exception e) {
        Assert.fail(e.getMessage());
    }
    ReservationSubmissionRequest sRequest = ReservationSystemTestUtil.createSimpleReservationRequest(reservationID, 4, arrival, deadline, duration);
    try {
        sResponse = clientService.submitReservation(sRequest);
    } catch (Exception e) {
        Assert.fail(e.getMessage());
    }
    Assert.assertNotNull(sResponse);
    Assert.assertNotNull(reservationID);
    System.out.println("Submit reservation response: " + reservationID);
    return sRequest;
}
Also used : ReservationId(org.apache.hadoop.yarn.api.records.ReservationId) GetNewReservationRequest(org.apache.hadoop.yarn.api.protocolrecords.GetNewReservationRequest) ReservationSubmissionRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest) ReservationSubmissionResponse(org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse) ApplicationNotFoundException(org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException) IOException(java.io.IOException) BrokenBarrierException(java.util.concurrent.BrokenBarrierException) AccessControlException(java.security.AccessControlException) YarnException(org.apache.hadoop.yarn.exceptions.YarnException)

Example 2 with GetNewReservationRequest

use of org.apache.hadoop.yarn.api.protocolrecords.GetNewReservationRequest in project hadoop by apache.

the class TestReservationSystemWithRMHA method getNewReservation.

private GetNewReservationResponse getNewReservation(ClientRMService clientRMService) {
    GetNewReservationRequest newReservationRequest = GetNewReservationRequest.newInstance();
    GetNewReservationResponse getNewReservationResponse = null;
    try {
        getNewReservationResponse = clientRMService.getNewReservation(newReservationRequest);
    } catch (Exception e) {
        Assert.fail(e.getMessage());
    }
    return getNewReservationResponse;
}
Also used : GetNewReservationRequest(org.apache.hadoop.yarn.api.protocolrecords.GetNewReservationRequest) GetNewReservationResponse(org.apache.hadoop.yarn.api.protocolrecords.GetNewReservationResponse)

Example 3 with GetNewReservationRequest

use of org.apache.hadoop.yarn.api.protocolrecords.GetNewReservationRequest in project hadoop by apache.

the class ReservationACLsTestBase method createReservation.

private ReservationId createReservation(String creator) throws Exception {
    ApplicationClientProtocol creatorClient = getRMClientForUser(creator);
    GetNewReservationRequest getNewReservationRequest = GetNewReservationRequest.newInstance();
    GetNewReservationResponse response = creatorClient.getNewReservation(getNewReservationRequest);
    return response.getReservationId();
}
Also used : GetNewReservationRequest(org.apache.hadoop.yarn.api.protocolrecords.GetNewReservationRequest) ApplicationClientProtocol(org.apache.hadoop.yarn.api.ApplicationClientProtocol) GetNewReservationResponse(org.apache.hadoop.yarn.api.protocolrecords.GetNewReservationResponse)

Example 4 with GetNewReservationRequest

use of org.apache.hadoop.yarn.api.protocolrecords.GetNewReservationRequest in project hadoop by apache.

the class RMWebServices method createNewReservation.

/**
   * Function that actually creates the {@link ReservationId} by calling the
   * ClientRMService.
   *
   * @return returns structure containing the {@link ReservationId}
   * @throws IOException if creation fails.
   */
private NewReservation createNewReservation() throws IOException {
    GetNewReservationRequest req = recordFactory.newRecordInstance(GetNewReservationRequest.class);
    GetNewReservationResponse resp;
    try {
        resp = rm.getClientRMService().getNewReservation(req);
    } catch (YarnException e) {
        String msg = "Unable to create new reservation from RM web service";
        LOG.error(msg, e);
        throw new YarnRuntimeException(msg, e);
    }
    NewReservation reservationId = new NewReservation(resp.getReservationId().toString());
    return reservationId;
}
Also used : YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) GetNewReservationRequest(org.apache.hadoop.yarn.api.protocolrecords.GetNewReservationRequest) NewReservation(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NewReservation) GetNewReservationResponse(org.apache.hadoop.yarn.api.protocolrecords.GetNewReservationResponse) YarnException(org.apache.hadoop.yarn.exceptions.YarnException)

Aggregations

GetNewReservationRequest (org.apache.hadoop.yarn.api.protocolrecords.GetNewReservationRequest)4 GetNewReservationResponse (org.apache.hadoop.yarn.api.protocolrecords.GetNewReservationResponse)3 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)2 IOException (java.io.IOException)1 AccessControlException (java.security.AccessControlException)1 BrokenBarrierException (java.util.concurrent.BrokenBarrierException)1 ApplicationClientProtocol (org.apache.hadoop.yarn.api.ApplicationClientProtocol)1 ReservationSubmissionRequest (org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest)1 ReservationSubmissionResponse (org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse)1 ReservationId (org.apache.hadoop.yarn.api.records.ReservationId)1 ApplicationNotFoundException (org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException)1 YarnRuntimeException (org.apache.hadoop.yarn.exceptions.YarnRuntimeException)1 NewReservation (org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NewReservation)1