Search in sources :

Example 1 with InvalidContainerRequestException

use of org.apache.hadoop.yarn.client.api.InvalidContainerRequestException in project hadoop by apache.

the class AMRMClientImpl method checkLocalityRelaxationConflict.

/**
   * ContainerRequests with locality relaxation cannot be made at the same
   * priority as ContainerRequests without locality relaxation.
   */
private void checkLocalityRelaxationConflict(Long allocationReqId, Priority priority, Collection<String> locations, boolean relaxLocality) {
    // Locality relaxation will be set to relaxLocality for all implicitly
    // requested racks. Make sure that existing rack requests match this.
    RemoteRequestsTable<T> remoteRequestsTable = getTable(allocationReqId);
    if (remoteRequestsTable != null) {
        @SuppressWarnings("unchecked") List<ResourceRequestInfo> allCapabilityMaps = remoteRequestsTable.getAllResourceRequestInfos(priority, locations);
        for (ResourceRequestInfo reqs : allCapabilityMaps) {
            ResourceRequest remoteRequest = reqs.remoteRequest;
            boolean existingRelaxLocality = remoteRequest.getRelaxLocality();
            if (relaxLocality != existingRelaxLocality) {
                throw new InvalidContainerRequestException("Cannot submit a " + "ContainerRequest asking for location " + remoteRequest.getResourceName() + " with locality relaxation " + relaxLocality + " when it has already been requested" + "with locality relaxation " + existingRelaxLocality);
            }
        }
    }
}
Also used : InvalidContainerRequestException(org.apache.hadoop.yarn.client.api.InvalidContainerRequestException) ResourceRequest(org.apache.hadoop.yarn.api.records.ResourceRequest)

Aggregations

ResourceRequest (org.apache.hadoop.yarn.api.records.ResourceRequest)1 InvalidContainerRequestException (org.apache.hadoop.yarn.client.api.InvalidContainerRequestException)1