public virtual void ContainerCompleted(RMContainer rmContainer, ContainerStatus containerStatus , RMContainerEventType @event) { lock (this) { Container container = rmContainer.GetContainer(); ContainerId containerId = container.GetId(); // Remove from the list of newly allocated containers if found newlyAllocatedContainers.Remove(rmContainer); // Inform the container rmContainer.Handle(new RMContainerFinishedEvent(containerId, containerStatus, @event )); Log.Info("Completed container: " + rmContainer.GetContainerId() + " in state: " + rmContainer.GetState() + " event:" + @event); // Remove from the list of containers Sharpen.Collections.Remove(liveContainers, rmContainer.GetContainerId()); RMAuditLogger.LogSuccess(GetUser(), RMAuditLogger.AuditConstants.ReleaseContainer , "SchedulerApp", GetApplicationId(), containerId); // Update usage metrics Org.Apache.Hadoop.Yarn.Api.Records.Resource containerResource = rmContainer.GetContainer ().GetResource(); queue.GetMetrics().ReleaseResources(GetUser(), 1, containerResource); Resources.SubtractFrom(currentConsumption, containerResource); // remove from preemption map if it is completed Sharpen.Collections.Remove(preemptionMap, rmContainer); // Clear resource utilization metrics cache. lastMemoryAggregateAllocationUpdateTime = -1; } }
protected internal override void CompletedContainer(RMContainer rmContainer, ContainerStatus containerStatus, RMContainerEventType @event) { lock (this) { if (rmContainer == null) { Log.Info("Null container completed..."); return; } // Get the application for the finished container Container container = rmContainer.GetContainer(); FiCaSchedulerApp application = GetCurrentAttemptForContainer(container.GetId()); ApplicationId appId = container.GetId().GetApplicationAttemptId().GetApplicationId (); // Get the node on which the container was allocated FiCaSchedulerNode node = GetNode(container.GetNodeId()); if (application == null) { Log.Info("Unknown application: " + appId + " released container " + container.GetId () + " on node: " + node + " with event: " + @event); return; } // Inform the application application.ContainerCompleted(rmContainer, containerStatus, @event); // Inform the node node.ReleaseContainer(container); // Update total usage Resources.SubtractFrom(usedResource, container.GetResource()); Log.Info("Application attempt " + application.GetApplicationAttemptId() + " released container " + container.GetId() + " on node: " + node + " with event: " + @event); } }
// clean up a completed container protected internal abstract void CompletedContainer(RMContainer rmContainer, ContainerStatus containerStatus, RMContainerEventType @event);
public RMContainerFinishedEvent(ContainerId containerId, ContainerStatus containerStatus , RMContainerEventType @event) : base(containerId, @event) { this.remoteContainerStatus = containerStatus; }
public override void CompletedContainer(Org.Apache.Hadoop.Yarn.Api.Records.Resource clusterResource, FiCaSchedulerApp application, FiCaSchedulerNode node, RMContainer rmContainer, ContainerStatus containerStatus, RMContainerEventType @event, CSQueue completedChildQueue, bool sortQueues) { if (application != null) { // Careful! Locking order is important! // Book keeping lock (this) { base.ReleaseResource(clusterResource, rmContainer.GetContainer().GetResource(), node .GetLabels()); Log.Info("completedContainer" + " queue=" + GetQueueName() + " usedCapacity=" + GetUsedCapacity () + " absoluteUsedCapacity=" + GetAbsoluteUsedCapacity() + " used=" + queueUsage .GetUsed() + " cluster=" + clusterResource); // Note that this is using an iterator on the childQueues so this can't // be called if already within an iterator for the childQueues. Like // from assignContainersToChildQueues. if (sortQueues) { // reinsert the updated queue for (IEnumerator <CSQueue> iter = childQueues.GetEnumerator(); iter.HasNext();) { CSQueue csqueue = iter.Next(); if (csqueue.Equals(completedChildQueue)) { iter.Remove(); Log.Info("Re-sorting completed queue: " + csqueue.GetQueuePath() + " stats: " + csqueue ); childQueues.AddItem(csqueue); break; } } } } // Inform the parent if (parent != null) { // complete my parent parent.CompletedContainer(clusterResource, application, node, rmContainer, null, @event, this, sortQueues); } } }
public abstract void CompletedContainer(Org.Apache.Hadoop.Yarn.Api.Records.Resource arg1, FiCaSchedulerApp arg2, FiCaSchedulerNode arg3, RMContainer arg4, ContainerStatus arg5, RMContainerEventType arg6, CSQueue arg7, bool arg8);