public virtual ContainersInfo GetContainers(HttpServletRequest req, HttpServletResponse res, string appId, string appAttemptId) { UserGroupInformation callerUGI = GetUser(req); ApplicationId aid = ParseApplicationId(appId); ApplicationAttemptId aaid = ParseApplicationAttemptId(appAttemptId); ValidateIds(aid, aaid, null); ICollection <ContainerReport> containerReports = null; try { if (callerUGI == null) { GetContainersRequest request = GetContainersRequest.NewInstance(aaid); containerReports = appBaseProt.GetContainers(request).GetContainerList(); } else { containerReports = callerUGI.DoAs(new _PrivilegedExceptionAction_332(this, aaid)); } } catch (Exception e) { RewrapAndThrowException(e); } ContainersInfo containersInfo = new ContainersInfo(); foreach (ContainerReport containerReport in containerReports) { ContainerInfo containerInfo = new ContainerInfo(containerReport); containersInfo.Add(containerInfo); } return(containersInfo); }
public virtual ContainersInfo GetNodeContainers() { Init(); ContainersInfo allContainers = new ContainersInfo(); foreach (KeyValuePair <ContainerId, Org.Apache.Hadoop.Yarn.Server.Nodemanager.Containermanager.Container.Container > entry in this.nmContext.GetContainers()) { if (entry.Value == null) { // just skip it continue; } ContainerInfo info = new ContainerInfo(this.nmContext, entry.Value, uriInfo.GetBaseUri ().ToString(), webapp.Name()); allContainers.Add(info); } return(allContainers); }