/// <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); }
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(); } }