Search in sources :

Example 31 with ApplicationClientProtocol

use of org.apache.hadoop.yarn.api.ApplicationClientProtocol in project hadoop by apache.

the class QueueACLsTestBase method verifyGetClientAMToken.

private void verifyGetClientAMToken(String submitter, String queueAdmin, String queueName, boolean setupACLs) throws Exception {
    ApplicationId applicationId = submitAppAndGetAppId(submitter, queueName, setupACLs);
    final GetApplicationReportRequest appReportRequest = GetApplicationReportRequest.newInstance(applicationId);
    ApplicationClientProtocol submitterClient = getRMClientForUser(submitter);
    ApplicationClientProtocol adMinUserClient = getRMClientForUser(queueAdmin);
    GetApplicationReportResponse submitterGetReport = submitterClient.getApplicationReport(appReportRequest);
    GetApplicationReportResponse adMinUserGetReport = adMinUserClient.getApplicationReport(appReportRequest);
    Assert.assertEquals(submitterGetReport.getApplicationReport().getClientToAMToken(), adMinUserGetReport.getApplicationReport().getClientToAMToken());
}
Also used : GetApplicationReportRequest(org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) GetApplicationReportResponse(org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse) ApplicationClientProtocol(org.apache.hadoop.yarn.api.ApplicationClientProtocol)

Example 32 with ApplicationClientProtocol

use of org.apache.hadoop.yarn.api.ApplicationClientProtocol 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 33 with ApplicationClientProtocol

use of org.apache.hadoop.yarn.api.ApplicationClientProtocol 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)

Example 34 with ApplicationClientProtocol

use of org.apache.hadoop.yarn.api.ApplicationClientProtocol in project hadoop by apache.

the class TestApplicationPriorityACLs method verifyAppPriorityIsAccepted.

private void verifyAppPriorityIsAccepted(String submitter, ApplicationId applicationId, int priority) throws IOException, InterruptedException {
    ApplicationClientProtocol submitterClient = getRMClientForUser(submitter);
    /**
     * If priority is greater than cluster max, RM will auto set to cluster max
     * Consider this scenario as a special case.
     */
    if (priority > clusterMaxPriority) {
        priority = clusterMaxPriority;
    }
    GetApplicationReportRequest request = GetApplicationReportRequest.newInstance(applicationId);
    try {
        GetApplicationReportResponse response = submitterClient.getApplicationReport(request);
        Assert.assertEquals(response.getApplicationReport().getPriority(), Priority.newInstance(priority));
    } catch (YarnException e) {
        Assert.fail("Application submission should not fail.");
    }
}
Also used : GetApplicationReportRequest(org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest) GetApplicationReportResponse(org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse) ApplicationClientProtocol(org.apache.hadoop.yarn.api.ApplicationClientProtocol) YarnException(org.apache.hadoop.yarn.exceptions.YarnException)

Example 35 with ApplicationClientProtocol

use of org.apache.hadoop.yarn.api.ApplicationClientProtocol in project hadoop by apache.

the class ReservationACLsTestBase method listReservationById.

private ReservationListResponse listReservationById(String lister, ReservationId reservationId, String queueName) throws Exception {
    final ReservationListRequest listRequest = ReservationListRequest.newInstance(queueName, reservationId.toString(), -1, -1, false);
    ApplicationClientProtocol ownerClient = getRMClientForUser(lister);
    return ownerClient.listReservations(listRequest);
}
Also used : ReservationListRequest(org.apache.hadoop.yarn.api.protocolrecords.ReservationListRequest) ApplicationClientProtocol(org.apache.hadoop.yarn.api.ApplicationClientProtocol)

Aggregations

ApplicationClientProtocol (org.apache.hadoop.yarn.api.ApplicationClientProtocol)42 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)12 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)12 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)11 Test (org.junit.Test)11 IOException (java.io.IOException)9 GetApplicationReportRequest (org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest)8 KillApplicationRequest (org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest)8 Configuration (org.apache.hadoop.conf.Configuration)7 GetNewApplicationRequest (org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationRequest)7 YarnRPC (org.apache.hadoop.yarn.ipc.YarnRPC)7 InetSocketAddress (java.net.InetSocketAddress)6 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)6 AccessControlList (org.apache.hadoop.security.authorize.AccessControlList)5 GetApplicationReportResponse (org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse)5 HashSet (java.util.HashSet)4 SubmitApplicationRequest (org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest)4 ImmutableSet (com.google.common.collect.ImmutableSet)3 EnumSet (java.util.EnumSet)3 HashMap (java.util.HashMap)3