/// <summary> /// Create and return a container object reflecting an allocation for the /// given appliction on the given node with the given capability and /// priority. /// </summary> public virtual Container CreateContainer(FSSchedulerNode node, Org.Apache.Hadoop.Yarn.Api.Records.Resource capability, Priority priority) { NodeId nodeId = node.GetRMNode().GetNodeID(); ContainerId containerId = BuilderUtils.NewContainerId(GetApplicationAttemptId(), GetNewContainerId()); // Create the container Container container = BuilderUtils.NewContainer(containerId, nodeId, node.GetRMNode ().GetHttpAddress(), capability, priority, null); return(container); }
/// <summary> /// Whether this app has containers requests that could be satisfied on the /// given node, if the node had full space. /// </summary> public virtual bool HasContainerForNode(Priority prio, FSSchedulerNode node) { ResourceRequest anyRequest = GetResourceRequest(prio, ResourceRequest.Any); ResourceRequest rackRequest = GetResourceRequest(prio, node.GetRackName()); ResourceRequest nodeRequest = GetResourceRequest(prio, node.GetNodeName()); return(anyRequest != null && anyRequest.GetNumContainers() > 0 && (anyRequest.GetRelaxLocality () || (rackRequest != null && rackRequest.GetNumContainers() > 0)) && (rackRequest == null || rackRequest.GetRelaxLocality() || (nodeRequest != null && nodeRequest .GetNumContainers() > 0)) && Resources.LessThanOrEqual(ResourceCalculator, null, anyRequest.GetCapability(), node.GetRMNode().GetTotalCapability())); }