org.apache.hadoop.yarn.ipc.RPCUtil Java Examples

The following examples show how to use org.apache.hadoop.yarn.ipc.RPCUtil. 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: ClientRMService.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public CancelDelegationTokenResponse cancelDelegationToken(
    CancelDelegationTokenRequest request) throws YarnException {
  try {
    if (!isAllowedDelegationTokenOp()) {
      throw new IOException(
          "Delegation Token can be cancelled only with kerberos authentication");
    }
    org.apache.hadoop.yarn.api.records.Token protoToken = request.getDelegationToken();
    Token<RMDelegationTokenIdentifier> token = new Token<RMDelegationTokenIdentifier>(
        protoToken.getIdentifier().array(), protoToken.getPassword().array(),
        new Text(protoToken.getKind()), new Text(protoToken.getService()));

    String user = UserGroupInformation.getCurrentUser().getUserName();
    rmDTSecretManager.cancelToken(token, user);
    return Records.newRecord(CancelDelegationTokenResponse.class);
  } catch (IOException e) {
    throw RPCUtil.getRemoteException(e);
  }
}
 
Example #2
Source File: TestRPC.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public StartContainersResponse startContainers(
    StartContainersRequest requests) throws YarnException {
  StartContainersResponse response =
      recordFactory.newRecordInstance(StartContainersResponse.class);
  for (StartContainerRequest request : requests.getStartContainerRequests()) {
    Token containerToken = request.getContainerToken();
    ContainerTokenIdentifier tokenId = null;

    try {
      tokenId = newContainerTokenIdentifier(containerToken);
    } catch (IOException e) {
      throw RPCUtil.getRemoteException(e);
    }
    ContainerStatus status =
        recordFactory.newRecordInstance(ContainerStatus.class);
    status.setState(ContainerState.RUNNING);
    status.setContainerId(tokenId.getContainerID());
    status.setExitStatus(0);
    statuses.add(status);

  }
  return response;
}
 
Example #3
Source File: NMClientAsyncImpl.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public void startContainerAsync(
    Container container, ContainerLaunchContext containerLaunchContext) {
  if (containers.putIfAbsent(container.getId(),
      new StatefulContainer(this, container.getId())) != null) {
    callbackHandler.onStartContainerError(container.getId(),
        RPCUtil.getRemoteException("Container " + container.getId() +
            " is already started or scheduled to start"));
  }
  try {
    events.put(new StartContainerEvent(container, containerLaunchContext));
  } catch (InterruptedException e) {
    LOG.warn("Exception when scheduling the event of starting Container " +
        container.getId());
    callbackHandler.onStartContainerError(container.getId(), e);
  }
}
 
Example #4
Source File: SCMAdminProtocolService.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private void checkAcls(String method) throws YarnException {
  UserGroupInformation user;
  try {
    user = UserGroupInformation.getCurrentUser();
  } catch (IOException ioe) {
    LOG.warn("Couldn't get current user", ioe);
    throw RPCUtil.getRemoteException(ioe);
  }

  if (!authorizer.isAdmin(user)) {
    LOG.warn("User " + user.getShortUserName() + " doesn't have permission" +
        " to call '" + method + "'");

    throw RPCUtil.getRemoteException(
        new AccessControlException("User " + user.getShortUserName() +
        " doesn't have permission" + " to call '" + method + "'"));
  }
  LOG.info("SCM Admin: " + method + " invoked by user " +
      user.getShortUserName());
}
 
Example #5
Source File: ContainerManagerImpl.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private ContainerStatus getContainerStatusInternal(ContainerId containerID,
    NMTokenIdentifier nmTokenIdentifier) throws YarnException {
  String containerIDStr = containerID.toString();
  Container container = this.context.getContainers().get(containerID);

  LOG.info("Getting container-status for " + containerIDStr);
  authorizeGetAndStopContainerRequest(containerID, container, false,
    nmTokenIdentifier);

  if (container == null) {
    if (nodeStatusUpdater.isContainerRecentlyStopped(containerID)) {
      throw RPCUtil.getRemoteException("Container " + containerIDStr
        + " was recently stopped on node manager.");
    } else {
      throw RPCUtil.getRemoteException("Container " + containerIDStr
        + " is not handled by this NodeManager");
    }
  }
  ContainerStatus containerStatus = container.cloneAndGetContainerStatus();
  LOG.info("Returning " + containerStatus);
  return containerStatus;
}
 
Example #6
Source File: ClientRMService.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private String checkReservationACLs(String queueName, String auditConstant)
    throws YarnException {
  UserGroupInformation callerUGI;
  try {
    callerUGI = UserGroupInformation.getCurrentUser();
  } catch (IOException ie) {
    RMAuditLogger.logFailure("UNKNOWN", auditConstant, queueName,
        "ClientRMService", "Error getting UGI");
    throw RPCUtil.getRemoteException(ie);
  }
  // Check if user has access on the managed queue
  if (!queueACLsManager.checkAccess(callerUGI, QueueACL.SUBMIT_APPLICATIONS,
      queueName)) {
    RMAuditLogger.logFailure(
        callerUGI.getShortUserName(),
        auditConstant,
        "User doesn't have permissions to "
            + QueueACL.SUBMIT_APPLICATIONS.toString(), "ClientRMService",
        AuditConstants.UNAUTHORIZED_USER);
    throw RPCUtil.getRemoteException(new AccessControlException("User "
        + callerUGI.getShortUserName() + " cannot perform operation "
        + QueueACL.SUBMIT_APPLICATIONS.name() + " on queue" + queueName));
  }
  return callerUGI.getShortUserName();
}
 
Example #7
Source File: ClientRMService.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws YarnException {
  try {
    if (!isAllowedDelegationTokenOp()) {
      throw new IOException(
          "Delegation Token can be renewed only with kerberos authentication");
    }
    
    org.apache.hadoop.yarn.api.records.Token protoToken = request.getDelegationToken();
    Token<RMDelegationTokenIdentifier> token = new Token<RMDelegationTokenIdentifier>(
        protoToken.getIdentifier().array(), protoToken.getPassword().array(),
        new Text(protoToken.getKind()), new Text(protoToken.getService()));

    String user = getRenewerForToken(token);
    long nextExpTime = rmDTSecretManager.renewToken(token, user);
    RenewDelegationTokenResponse renewResponse = Records
        .newRecord(RenewDelegationTokenResponse.class);
    renewResponse.setNextExpirationTime(nextExpTime);
    return renewResponse;
  } catch (IOException e) {
    throw RPCUtil.getRemoteException(e);
  }
}
 
Example #8
Source File: ContainerManagerImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
protected UserGroupInformation getRemoteUgi()
    throws YarnException {
  UserGroupInformation remoteUgi;
  try {
    remoteUgi = UserGroupInformation.getCurrentUser();
  } catch (IOException e) {
    String msg = "Cannot obtain the user-name. Got exception: "
        + StringUtils.stringifyException(e);
    LOG.warn(msg);
    throw RPCUtil.getRemoteException(msg);
  }
  return remoteUgi;
}
 
Example #9
Source File: ClientRMService.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public GetApplicationAttemptsResponse getApplicationAttempts(
    GetApplicationAttemptsRequest request) throws YarnException, IOException {
  ApplicationId appId = request.getApplicationId();
  UserGroupInformation callerUGI;
  try {
    callerUGI = UserGroupInformation.getCurrentUser();
  } catch (IOException ie) {
    LOG.info("Error getting UGI ", ie);
    throw RPCUtil.getRemoteException(ie);
  }
  RMApp application = this.rmContext.getRMApps().get(appId);
  if (application == null) {
    // If the RM doesn't have the application, throw
    // ApplicationNotFoundException and let client to handle.
    throw new ApplicationNotFoundException("Application with id '" + appId
        + "' doesn't exist in RM.");
  }
  boolean allowAccess = checkAccess(callerUGI, application.getUser(),
      ApplicationAccessType.VIEW_APP, application);
  GetApplicationAttemptsResponse response = null;
  if (allowAccess) {
    Map<ApplicationAttemptId, RMAppAttempt> attempts = application
        .getAppAttempts();
    List<ApplicationAttemptReport> listAttempts = 
      new ArrayList<ApplicationAttemptReport>();
    Iterator<Map.Entry<ApplicationAttemptId, RMAppAttempt>> iter = attempts
        .entrySet().iterator();
    while (iter.hasNext()) {
      listAttempts.add(iter.next().getValue()
          .createApplicationAttemptReport());
    }
    response = GetApplicationAttemptsResponse.newInstance(listAttempts);
  } else {
    throw new YarnException("User " + callerUGI.getShortUserName()
        + " does not have privilage to see this aplication " + appId);
  }
  return response;
}
 
Example #10
Source File: ClientRMService.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public ReservationUpdateResponse updateReservation(
    ReservationUpdateRequest request) throws YarnException, IOException {
  // Check if reservation system is enabled
  checkReservationSytem(AuditConstants.UPDATE_RESERVATION_REQUEST);
  ReservationUpdateResponse response =
      recordFactory.newRecordInstance(ReservationUpdateResponse.class);
  // Validate the input
  Plan plan =
      rValidator.validateReservationUpdateRequest(reservationSystem, request);
  ReservationId reservationId = request.getReservationId();
  String queueName = reservationSystem.getQueueForReservation(reservationId);
  // Check ACLs
  String user =
      checkReservationACLs(queueName,
          AuditConstants.UPDATE_RESERVATION_REQUEST);
  // Try to update the reservation using default agent
  try {
    boolean result =
        plan.getReservationAgent().updateReservation(reservationId, user,
            plan, request.getReservationDefinition());
    if (!result) {
      String errMsg = "Unable to update reservation: " + reservationId;
      RMAuditLogger.logFailure(user,
          AuditConstants.UPDATE_RESERVATION_REQUEST, errMsg,
          "ClientRMService", errMsg);
      throw RPCUtil.getRemoteException(errMsg);
    }
  } catch (PlanningException e) {
    RMAuditLogger.logFailure(user, AuditConstants.UPDATE_RESERVATION_REQUEST,
        e.getMessage(), "ClientRMService",
        "Unable to update the reservation: " + reservationId);
    throw RPCUtil.getRemoteException(e);
  }
  RMAuditLogger.logSuccess(user, AuditConstants.UPDATE_RESERVATION_REQUEST,
      "ClientRMService: " + reservationId);
  return response;
}
 
Example #11
Source File: LocalizationProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public LocalizerHeartbeatResponse heartbeat(LocalizerStatus status)
  throws YarnException, IOException {
  LocalizerStatusProto statusProto = ((LocalizerStatusPBImpl)status).getProto();
  try {
    return new LocalizerHeartbeatResponsePBImpl(
        proxy.heartbeat(null, statusProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #12
Source File: ContainerManagerImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private void stopContainerInternal(NMTokenIdentifier nmTokenIdentifier,
    ContainerId containerID) throws YarnException, IOException {
  String containerIDStr = containerID.toString();
  Container container = this.context.getContainers().get(containerID);
  LOG.info("Stopping container with container Id: " + containerIDStr);
  authorizeGetAndStopContainerRequest(containerID, container, true,
    nmTokenIdentifier);

  if (container == null) {
    if (!nodeStatusUpdater.isContainerRecentlyStopped(containerID)) {
      throw RPCUtil.getRemoteException("Container " + containerIDStr
        + " is not handled by this NodeManager");
    }
  } else {
    context.getNMStateStore().storeContainerKilled(containerID);
    dispatcher.getEventHandler().handle(
      new ContainerKillEvent(containerID,
          ContainerExitStatus.KILLED_BY_APPMASTER,
          "Container killed by the ApplicationMaster."));

    NMAuditLogger.logSuccess(container.getUser(),    
      AuditConstants.STOP_CONTAINER, "ContainerManageImpl", containerID
        .getApplicationAttemptId().getApplicationId(), containerID);

    // TODO: Move this code to appropriate place once kill_container is
    // implemented.
    nodeStatusUpdater.sendOutofBandHeartBeat();
  }
}
 
Example #13
Source File: ContainerManagerImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
protected void authorizeUser(UserGroupInformation remoteUgi,
    NMTokenIdentifier nmTokenIdentifier) throws YarnException {
  if (!remoteUgi.getUserName().equals(
    nmTokenIdentifier.getApplicationAttemptId().toString())) {
    throw RPCUtil.getRemoteException("Expected applicationAttemptId: "
        + remoteUgi.getUserName() + "Found: "
        + nmTokenIdentifier.getApplicationAttemptId());
  }
}
 
Example #14
Source File: AdminService.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private UserGroupInformation checkAcls(String method) throws YarnException {
  try {
    return checkAccess(method);
  } catch (IOException ioe) {
    throw RPCUtil.getRemoteException(ioe);
  }
}
 
Example #15
Source File: ApplicationClientProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public ReservationDeleteResponse deleteReservation(ReservationDeleteRequest request)
    throws YarnException, IOException {
  ReservationDeleteRequestProto requestProto =
      ((ReservationDeleteRequestPBImpl) request).getProto();
  try {
    return new ReservationDeleteResponsePBImpl(proxy.deleteReservation(null,
        requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #16
Source File: ClientRMService.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * It gives response which includes application report if the application
 * present otherwise throws ApplicationNotFoundException.
 */
@Override
public GetApplicationReportResponse getApplicationReport(
    GetApplicationReportRequest request) throws YarnException {
  ApplicationId applicationId = request.getApplicationId();

  UserGroupInformation callerUGI;
  try {
    callerUGI = UserGroupInformation.getCurrentUser();
  } catch (IOException ie) {
    LOG.info("Error getting UGI ", ie);
    throw RPCUtil.getRemoteException(ie);
  }

  RMApp application = this.rmContext.getRMApps().get(applicationId);
  if (application == null) {
    // If the RM doesn't have the application, throw
    // ApplicationNotFoundException and let client to handle.
    throw new ApplicationNotFoundException("Application with id '"
        + applicationId + "' doesn't exist in RM.");
  }

  boolean allowAccess = checkAccess(callerUGI, application.getUser(),
      ApplicationAccessType.VIEW_APP, application);
  ApplicationReport report =
      application.createAndGetApplicationReport(callerUGI.getUserName(),
          allowAccess);

  GetApplicationReportResponse response = recordFactory
      .newRecordInstance(GetApplicationReportResponse.class);
  response.setApplicationReport(report);
  return response;
}
 
Example #17
Source File: ResourceManagerAdministrationProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public RemoveFromClusterNodeLabelsResponse removeFromClusterNodeLabels(
    RemoveFromClusterNodeLabelsRequest request) throws YarnException,
    IOException {
  RemoveFromClusterNodeLabelsRequestProto requestProto =
      ((RemoveFromClusterNodeLabelsRequestPBImpl) request).getProto();
  try {
    return new RemoveFromClusterNodeLabelsResponsePBImpl(
        proxy.removeFromClusterNodeLabels(null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #18
Source File: NMClientAsyncImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void transition(StatefulContainer container, ContainerEvent event) {
  try {
    container.nmClientAsync.getCallbackHandler().onStartContainerError(
        event.getContainerId(),
        RPCUtil.getRemoteException(STOP_BEFORE_START_ERROR_MSG));
  } catch (Throwable thr) {
    // Don't process user created unchecked exception
    LOG.info(
        "Unchecked exception is thrown from onStartContainerError for " +
            "Container " + event.getContainerId(), thr);
  }
}
 
Example #19
Source File: ResourceManagerAdministrationProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public UpdateNodeResourceResponse updateNodeResource(
    UpdateNodeResourceRequest request) throws YarnException, IOException {
  UpdateNodeResourceRequestProto requestProto =
      ((UpdateNodeResourceRequestPBImpl) request).getProto();
  try {
    return new UpdateNodeResourceResponsePBImpl(proxy.updateNodeResource(null,
        requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #20
Source File: ResourceManagerAdministrationProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public RefreshServiceAclsResponse refreshServiceAcls(
    RefreshServiceAclsRequest request) throws YarnException,
    IOException {
  RefreshServiceAclsRequestProto requestProto = 
      ((RefreshServiceAclsRequestPBImpl)request).getProto();
  try {
    return new RefreshServiceAclsResponsePBImpl(proxy.refreshServiceAcls(
        null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #21
Source File: TestApplicationMasterLauncher.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public StartContainersResponse
    startContainers(StartContainersRequest requests)
        throws YarnException {
  StartContainerRequest request = requests.getStartContainerRequests().get(0);
  LOG.info("Container started by MyContainerManager: " + request);
  launched = true;
  Map<String, String> env =
      request.getContainerLaunchContext().getEnvironment();

  Token containerToken = request.getContainerToken();
  ContainerTokenIdentifier tokenId = null;

  try {
    tokenId = BuilderUtils.newContainerTokenIdentifier(containerToken);
  } catch (IOException e) {
    throw RPCUtil.getRemoteException(e);
  }

  ContainerId containerId = tokenId.getContainerID();
  containerIdAtContainerManager = containerId.toString();
  attemptIdAtContainerManager =
      containerId.getApplicationAttemptId().toString();
  nmHostAtContainerManager = tokenId.getNmHostAddress();
  submitTimeAtContainerManager =
      Long.parseLong(env.get(ApplicationConstants.APP_SUBMIT_TIME_ENV));
  maxAppAttempts =
      Integer.parseInt(env.get(ApplicationConstants.MAX_APP_ATTEMPTS_ENV));
  return StartContainersResponse.newInstance(
    new HashMap<String, ByteBuffer>(), new ArrayList<ContainerId>(),
    new HashMap<ContainerId, SerializedException>());
}
 
Example #22
Source File: ClientRMService.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private void checkReservationSytem(String auditConstant) throws YarnException {
  // Check if reservation is enabled
  if (reservationSystem == null) {
    throw RPCUtil.getRemoteException("Reservation is not enabled."
        + " Please enable & try again");
  }
}
 
Example #23
Source File: ResourceManagerAdministrationProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public RefreshSuperUserGroupsConfigurationResponse refreshSuperUserGroupsConfiguration(
    RefreshSuperUserGroupsConfigurationRequest request)
    throws YarnException, IOException {
  RefreshSuperUserGroupsConfigurationRequestProto requestProto = 
    ((RefreshSuperUserGroupsConfigurationRequestPBImpl)request).getProto();
  try {
    return new RefreshSuperUserGroupsConfigurationResponsePBImpl(
        proxy.refreshSuperUserGroupsConfiguration(null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #24
Source File: ResourceManagerAdministrationProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public RefreshNodesResponse refreshNodes(RefreshNodesRequest request)
throws YarnException, IOException {
  RefreshNodesRequestProto requestProto = 
    ((RefreshNodesRequestPBImpl)request).getProto();
  try {
    return new RefreshNodesResponsePBImpl(
        proxy.refreshNodes(null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #25
Source File: ResourceManagerAdministrationProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public RefreshQueuesResponse refreshQueues(RefreshQueuesRequest request)
    throws YarnException, IOException {
  RefreshQueuesRequestProto requestProto = 
    ((RefreshQueuesRequestPBImpl)request).getProto();
  try {
    return new RefreshQueuesResponsePBImpl(
        proxy.refreshQueues(null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #26
Source File: SCMAdminProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public RunSharedCacheCleanerTaskResponse runCleanerTask(
    RunSharedCacheCleanerTaskRequest request) throws YarnException,
    IOException {
  YarnServiceProtos.RunSharedCacheCleanerTaskRequestProto requestProto =
      ((RunSharedCacheCleanerTaskRequestPBImpl) request).getProto();
  try {
    return new RunSharedCacheCleanerTaskResponsePBImpl(proxy.runCleanerTask(null,
        requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #27
Source File: ApplicationClientProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public GetClusterNodeLabelsResponse getClusterNodeLabels(
    GetClusterNodeLabelsRequest request) throws YarnException, IOException {
    GetClusterNodeLabelsRequestProto
      requestProto =
      ((GetClusterNodeLabelsRequestPBImpl) request).getProto();
  try {
    return new GetClusterNodeLabelsResponsePBImpl(proxy.getClusterNodeLabels(
        null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #28
Source File: ApplicationClientProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public GetLabelsToNodesResponse getLabelsToNodes(
    GetLabelsToNodesRequest request)
    throws YarnException, IOException {
  YarnServiceProtos.GetLabelsToNodesRequestProto requestProto =
      ((GetLabelsToNodesRequestPBImpl) request).getProto();
  try {
    return new GetLabelsToNodesResponsePBImpl(proxy.getLabelsToNodes(
        null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #29
Source File: ApplicationClientProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public GetNodesToLabelsResponse getNodeToLabels(
    GetNodesToLabelsRequest request)
    throws YarnException, IOException {
  YarnServiceProtos.GetNodesToLabelsRequestProto
      requestProto =
      ((GetNodesToLabelsRequestPBImpl) request).getProto();
  try {
    return new GetNodesToLabelsResponsePBImpl(proxy.getNodeToLabels(
        null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #30
Source File: ApplicationMasterProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public AllocateResponse allocate(AllocateRequest request)
    throws YarnException, IOException {
  AllocateRequestProto requestProto =
      ((AllocateRequestPBImpl) request).getProto();
  try {
    return new AllocateResponsePBImpl(proxy.allocate(null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}