Example usage for org.apache.hadoop.yarn.client.api InvalidContainerRequestException InvalidContainerRequestException

List of usage examples for org.apache.hadoop.yarn.client.api InvalidContainerRequestException InvalidContainerRequestException

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.client.api InvalidContainerRequestException InvalidContainerRequestException.

Prototype

public InvalidContainerRequestException(String message) 

Source Link

Usage

From source file:disAMS.AMRMClient.Impl.AMRMClientImpl.java

License:Apache License

/**
 * ContainerRequests with locality relaxation cannot be made at the same
 * priority as ContainerRequests without locality relaxation.
 *///from  w w  w.  j  av a  2s .  co m
private void checkLocalityRelaxationConflict(Priority priority, Collection<String> locations,
        boolean relaxLocality) {
    Map<String, TreeMap<Resource, ResourceRequestInfo>> remoteRequests = this.remoteRequestsTable.get(priority);
    if (remoteRequests == null) {
        return;
    }
    // Locality relaxation will be set to relaxLocality for all implicitly
    // requested racks. Make sure that existing rack requests match this.
    for (String location : locations) {
        TreeMap<Resource, ResourceRequestInfo> reqs = remoteRequests.get(location);
        if (reqs != null && !reqs.isEmpty()) {
            boolean existingRelaxLocality = reqs.values().iterator().next().remoteRequest.getRelaxLocality();
            if (relaxLocality != existingRelaxLocality) {
                throw new InvalidContainerRequestException(
                        "Cannot submit a " + "ContainerRequest asking for location " + location
                                + " with locality relaxation " + relaxLocality + " when it has "
                                + "already been requested with locality relaxation " + existingRelaxLocality);
            }
        }
    }
}

From source file:disAMS.AMRMClient.Impl.AMRMClientImpl.java

License:Apache License

/**
 * Valid if a node label expression specified on container request is valid or
 * not/*from w  w w. j a v a 2  s . co m*/
 * 
 * @param containerRequest
 */
private void checkNodeLabelExpression(T containerRequest) {
    String exp = containerRequest.getNodeLabelExpression();

    if (null == exp || exp.isEmpty()) {
        return;
    }

    // Don't support specifying >= 2 node labels in a node label expression now
    if (exp.contains("&&") || exp.contains("||")) {
        throw new InvalidContainerRequestException(
                "Cannot specify more than two node labels" + " in a single node label expression");
    }

    // Don't allow specify node label against ANY request
    if ((containerRequest.getRacks() != null && (!containerRequest.getRacks().isEmpty()))
            || (containerRequest.getNodes() != null && (!containerRequest.getNodes().isEmpty()))) {
        throw new InvalidContainerRequestException("Cannot specify node label with rack and node");
    }
}