/// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> public StartContainersResponse StartContainers(StartContainersRequest requests) { StartContainerRequest request = requests.GetStartContainerRequests()[0]; Log.Info("Container started by MyContainerManager: " + request); launched = true; IDictionary <string, string> env = request.GetContainerLaunchContext().GetEnvironment (); Token containerToken = request.GetContainerToken(); ContainerTokenIdentifier tokenId = null; try { tokenId = BuilderUtils.NewContainerTokenIdentifier(containerToken); } catch (IOException e) { throw RPCUtil.GetRemoteException(e); } ContainerId containerId = tokenId.GetContainerID(); containerIdAtContainerManager = containerId.ToString(); attemptIdAtContainerManager = containerId.GetApplicationAttemptId().ToString(); nmHostAtContainerManager = tokenId.GetNmHostAddress(); submitTimeAtContainerManager = long.Parse(env[ApplicationConstants.AppSubmitTimeEnv ]); maxAppAttempts = System.Convert.ToInt32(env[ApplicationConstants.MaxAppAttemptsEnv ]); return(StartContainersResponse.NewInstance(new Dictionary <string, ByteBuffer>(), new AList <ContainerId>(), new Dictionary <ContainerId, SerializedException>())); }
/// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> public virtual StartContainersResponse StartContainers(StartContainersRequest requests ) { lock (this) { foreach (StartContainerRequest request in requests.GetStartContainerRequests()) { Token containerToken = request.GetContainerToken(); ContainerTokenIdentifier tokenId = null; try { tokenId = BuilderUtils.NewContainerTokenIdentifier(containerToken); } catch (IOException e) { throw RPCUtil.GetRemoteException(e); } ContainerId containerID = tokenId.GetContainerID(); ApplicationId applicationId = containerID.GetApplicationAttemptId().GetApplicationId (); IList <Container> applicationContainers = containers[applicationId]; if (applicationContainers == null) { applicationContainers = new AList <Container>(); containers[applicationId] = applicationContainers; } // Sanity check foreach (Container container in applicationContainers) { if (container.GetId().CompareTo(containerID) == 0) { throw new InvalidOperationException("Container " + containerID + " already setup on node " + containerManagerAddress); } } Container container_1 = BuilderUtils.NewContainer(containerID, this.nodeId, nodeHttpAddress , tokenId.GetResource(), null, null); // DKDC - Doesn't matter ContainerStatus containerStatus = BuilderUtils.NewContainerStatus(container_1.GetId (), ContainerState.New, string.Empty, -1000); applicationContainers.AddItem(container_1); containerStatusMap[container_1] = containerStatus; Resources.SubtractFrom(available, tokenId.GetResource()); Resources.AddTo(used, tokenId.GetResource()); if (Log.IsDebugEnabled()) { Log.Debug("startContainer:" + " node=" + containerManagerAddress + " application=" + applicationId + " container=" + container_1 + " available=" + available + " used=" + used); } } StartContainersResponse response = StartContainersResponse.NewInstance(null, null , null); return(response); } }
/// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> public StartContainersResponse StartContainers(StartContainersRequest request) { containerTokens = request.GetStartContainerRequests()[0].GetContainerLaunchContext ().GetTokens(); return(StartContainersResponse.NewInstance(null, null, null)); }