/// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> public virtual StopContainersResponse StopContainers(StopContainersRequest request ) { lock (this) { foreach (ContainerId containerID in request.GetContainerIds()) { string applicationId = containerID.GetApplicationAttemptId().GetApplicationId().GetId ().ToString(); // Mark the container as COMPLETE IList <Container> applicationContainers = containers[containerID.GetApplicationAttemptId ().GetApplicationId()]; foreach (Container c in applicationContainers) { if (c.GetId().CompareTo(containerID) == 0) { ContainerStatus containerStatus = containerStatusMap[c]; containerStatus.SetState(ContainerState.Complete); containerStatusMap[c] = containerStatus; } } // Send a heartbeat try { Heartbeat(); } catch (IOException ioe) { throw RPCUtil.GetRemoteException(ioe); } // Remove container and update status int ctr = 0; Container container = null; for (IEnumerator <Container> i = applicationContainers.GetEnumerator(); i.HasNext( );) { container = i.Next(); if (container.GetId().CompareTo(containerID) == 0) { i.Remove(); ++ctr; } } if (ctr != 1) { throw new InvalidOperationException("Container " + containerID + " stopped " + ctr + " times!"); } Resources.AddTo(available, container.GetResource()); Resources.SubtractFrom(used, container.GetResource()); if (Log.IsDebugEnabled()) { Log.Debug("stopContainer:" + " node=" + containerManagerAddress + " application=" + applicationId + " container=" + containerID + " available=" + available + " used=" + used); } } return(StopContainersResponse.NewInstance(null, null)); } }
/// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> public StopContainersResponse StopContainers(StopContainersRequest request) { return(StopContainersResponse.NewInstance(null, null)); }