@Override public int hashCode() { final int prime = 2153; int result = 2459; Resource capability = getCapability(); String hostName = getResourceName(); Priority priority = getPriority(); result = prime * result + ((capability == null) ? 0 : capability.hashCode()); result = prime * result + ((hostName == null) ? 0 : hostName.hashCode()); result = prime * result + getNumContainers(); result = prime * result + ((priority == null) ? 0 : priority.hashCode()); result = prime * result + Long.valueOf(getAllocationRequestId()).hashCode(); return result; }
private void prettyPrintRequests( Map<SubClusterId, List<ResourceRequest>> response) { for (Map.Entry<SubClusterId, List<ResourceRequest>> entry : response .entrySet()) { String str = ""; for (ResourceRequest rr : entry.getValue()) { str += " [id:" + rr.getAllocationRequestId() + " loc:" + rr.getResourceName() + " numCont:" + rr.getNumContainers() + "], "; } LOG.info(entry.getKey() + " --> " + str); } }
@Override public int compare(ResourceRequest r1, ResourceRequest r2) { // Compare priority, host and capability int ret = r1.getPriority().compareTo(r2.getPriority()); if (ret == 0) { ret = Long.compare( r1.getAllocationRequestId(), r2.getAllocationRequestId()); } if (ret == 0) { String h1 = r1.getResourceName(); String h2 = r2.getResourceName(); ret = h1.compareTo(h2); } if (ret == 0) { ret = r1.getExecutionTypeRequest() .compareTo(r2.getExecutionTypeRequest()); } if (ret == 0) { ret = r1.getCapability().compareTo(r2.getCapability()); } return ret; } }
this.getNumContainers() - other.getNumContainers(); if (numContainerComparison == 0) { return Long.compare(getAllocationRequestId(), other.getAllocationRequestId()); } else { return numContainerComparison;
if (getAllocationRequestId() != other.getAllocationRequestId()) { return false;
public ResourceRequestInfo(ResourceRequest request) { priority = request.getPriority().getPriority(); allocationRequestId = request.getAllocationRequestId(); resourceName = request.getResourceName(); capability = new ResourceInfo(request.getCapability()); numContainers = request.getNumContainers(); relaxLocality = request.getRelaxLocality(); nodeLabelExpression = request.getNodeLabelExpression(); if (request.getExecutionTypeRequest() != null) { executionTypeRequest = new ExecutionTypeRequestInfo(request.getExecutionTypeRequest()); } }
rr.getAllocationRequestId() == 2L || rr.getAllocationRequestId() == 4L || rr.getAllocationRequestId() == 5L); response.get(SubClusterId.newInstance("subcluster0")); for (ResourceRequest rr : rrs) { Assert.assertTrue(rr.getAllocationRequestId() != 1L); Assert.assertTrue(rr.getAllocationRequestId() != 4L); Assert.assertTrue(rr.getAllocationRequestId() == 1L || rr.getAllocationRequestId() == 2L); Assert.assertTrue(rr.getAllocationRequestId() == 1L || rr.getAllocationRequestId() == 2L); Assert.assertTrue(rr.getAllocationRequestId() == 2); Assert.assertTrue(rr.getRelaxLocality());
for (ResourceRequest rr : original) { originalContainers += rr.getNumContainers(); originalIds.add(rr.getAllocationRequestId()); for (ResourceRequest rr : rrs.getValue()) { splitContainers += rr.getNumContainers(); splitIds.add(rr.getAllocationRequestId());
/** * Clone a ResourceRequest object (shallow copy). Please keep it loaded with * all (new) fields * * @param rr the object to copy from * @return the copied object */ @Public @Evolving public static ResourceRequest clone(ResourceRequest rr) { // Please keep it loaded with all (new) fields return ResourceRequest.newBuilder().priority(rr.getPriority()) .resourceName(rr.getResourceName()).capability(rr.getCapability()) .numContainers(rr.getNumContainers()) .relaxLocality(rr.getRelaxLocality()) .nodeLabelExpression(rr.getNodeLabelExpression()) .executionTypeRequest(rr.getExecutionTypeRequest()) .allocationRequestId(rr.getAllocationRequestId()).build(); }