public AppAttemptInfo(ApplicationAttemptReport appAttempt) { // JAXB needs this appAttemptId = appAttempt.GetApplicationAttemptId().ToString(); host = appAttempt.GetHost(); rpcPort = appAttempt.GetRpcPort(); trackingUrl = appAttempt.GetTrackingUrl(); originalTrackingUrl = appAttempt.GetOriginalTrackingUrl(); diagnosticsInfo = appAttempt.GetDiagnostics(); appAttemptState = appAttempt.GetYarnApplicationAttemptState(); if (appAttempt.GetAMContainerId() != null) { amContainerId = appAttempt.GetAMContainerId().ToString(); } }
/// <summary>Prints the application attempt report for an application attempt id.</summary> /// <param name="applicationAttemptId"/> /// <returns>exitCode</returns> /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> /// <exception cref="System.IO.IOException"/> private int PrintApplicationAttemptReport(string applicationAttemptId) { ApplicationAttemptReport appAttemptReport = null; try { appAttemptReport = client.GetApplicationAttemptReport(ConverterUtils.ToApplicationAttemptId (applicationAttemptId)); } catch (ApplicationNotFoundException) { sysout.WriteLine("Application for AppAttempt with id '" + applicationAttemptId + "' doesn't exist in RM or Timeline Server."); return(-1); } catch (ApplicationAttemptNotFoundException) { sysout.WriteLine("Application Attempt with id '" + applicationAttemptId + "' doesn't exist in RM or Timeline Server." ); return(-1); } // Use PrintWriter.println, which uses correct platform line ending. ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintWriter appAttemptReportStr = new PrintWriter(new OutputStreamWriter(baos, Sharpen.Extensions.GetEncoding ("UTF-8"))); if (appAttemptReport != null) { appAttemptReportStr.WriteLine("Application Attempt Report : "); appAttemptReportStr.Write("\tApplicationAttempt-Id : "); appAttemptReportStr.WriteLine(appAttemptReport.GetApplicationAttemptId()); appAttemptReportStr.Write("\tState : "); appAttemptReportStr.WriteLine(appAttemptReport.GetYarnApplicationAttemptState()); appAttemptReportStr.Write("\tAMContainer : "); appAttemptReportStr.WriteLine(appAttemptReport.GetAMContainerId().ToString()); appAttemptReportStr.Write("\tTracking-URL : "); appAttemptReportStr.WriteLine(appAttemptReport.GetTrackingUrl()); appAttemptReportStr.Write("\tRPC Port : "); appAttemptReportStr.WriteLine(appAttemptReport.GetRpcPort()); appAttemptReportStr.Write("\tAM Host : "); appAttemptReportStr.WriteLine(appAttemptReport.GetHost()); appAttemptReportStr.Write("\tDiagnostics : "); appAttemptReportStr.Write(appAttemptReport.GetDiagnostics()); } else { appAttemptReportStr.Write("Application Attempt with id '" + applicationAttemptId + "' doesn't exist in Timeline Server."); appAttemptReportStr.Close(); sysout.WriteLine(baos.ToString("UTF-8")); return(-1); } appAttemptReportStr.Close(); sysout.WriteLine(baos.ToString("UTF-8")); return(0); }
protected override void GenerateOverview(ApplicationAttemptReport appAttemptReport , ICollection <ContainerReport> containers, AppAttemptInfo appAttempt, string node ) { string blacklistedNodes = "-"; ICollection <string> nodes = GetBlacklistedNodes(rm, GetRMAppAttempt().GetAppAttemptId ()); if (nodes != null) { if (!nodes.IsEmpty()) { blacklistedNodes = StringUtils.Join(nodes, ", "); } } Info("Application Attempt Overview").("Application Attempt State:", appAttempt.GetAppAttemptState () == null ? Unavailable : appAttempt.GetAppAttemptState()).("AM Container:", appAttempt .GetAmContainerId() == null || containers == null || !HasAMContainer(appAttemptReport .GetAMContainerId(), containers) ? null : Root_url("container", appAttempt.GetAmContainerId ()), appAttempt.GetAmContainerId().ToString()).("Node:", node).("Tracking URL:", appAttempt.GetTrackingUrl() == null || appAttempt.GetTrackingUrl().Equals(Unavailable ) ? null : Root_url(appAttempt.GetTrackingUrl()), appAttempt.GetTrackingUrl() == null || appAttempt.GetTrackingUrl().Equals(Unavailable) ? "Unassigned" : appAttempt .GetAppAttemptState() == YarnApplicationAttemptState.Finished || appAttempt.GetAppAttemptState () == YarnApplicationAttemptState.Failed || appAttempt.GetAppAttemptState() == YarnApplicationAttemptState .Killed ? "History" : "ApplicationMaster").("Diagnostics Info:", appAttempt.GetDiagnosticsInfo () == null ? string.Empty : appAttempt.GetDiagnosticsInfo()).("Blacklisted Nodes:" , blacklistedNodes); }
/// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> /// <exception cref="System.IO.IOException"/> public virtual ContainerReport GetAMContainer(ApplicationAttemptId appAttemptId) { ApplicationAttemptReport appAttempt = GetApplicationAttempt(appAttemptId, false); return(GetContainer(appAttempt.GetAMContainerId())); }
protected internal virtual void GenerateOverview(ApplicationAttemptReport appAttemptReport , ICollection <ContainerReport> containers, AppAttemptInfo appAttempt, string node ) { Info("Application Attempt Overview").("Application Attempt State:", appAttempt.GetAppAttemptState () == null ? Unavailable : appAttempt.GetAppAttemptState()).("AM Container:", appAttempt .GetAmContainerId() == null || containers == null || !HasAMContainer(appAttemptReport .GetAMContainerId(), containers) ? null : Root_url("container", appAttempt.GetAmContainerId ()), appAttempt.GetAmContainerId().ToString()).("Node:", node).("Tracking URL:", appAttempt.GetTrackingUrl() == null || appAttempt.GetTrackingUrl().Equals(Unavailable ) ? null : Root_url(appAttempt.GetTrackingUrl()), appAttempt.GetTrackingUrl() == null || appAttempt.GetTrackingUrl().Equals(Unavailable) ? "Unassigned" : appAttempt .GetAppAttemptState() == YarnApplicationAttemptState.Finished || appAttempt.GetAppAttemptState () == YarnApplicationAttemptState.Failed || appAttempt.GetAppAttemptState() == YarnApplicationAttemptState .Killed ? "History" : "ApplicationMaster").("Diagnostics Info:", appAttempt.GetDiagnosticsInfo () == null ? string.Empty : appAttempt.GetDiagnosticsInfo()); }