/// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
 /// <exception cref="System.IO.IOException"/>
 private ApplicationHistoryManagerOnTimelineStore.ApplicationReportExt GenerateApplicationReport
     (TimelineEntity entity, ApplicationHistoryManagerOnTimelineStore.ApplicationReportField
     field)
 {
     ApplicationHistoryManagerOnTimelineStore.ApplicationReportExt app = ConvertToApplicationReport
                                                                             (entity, field);
     // If only user and acls are pulled to check attempt(s)/container(s) access
     // control, we can return immediately
     if (field == ApplicationHistoryManagerOnTimelineStore.ApplicationReportField.UserAndAcls)
     {
         return(app);
     }
     try
     {
         CheckAccess(app);
         if (app.appReport.GetCurrentApplicationAttemptId() != null)
         {
             ApplicationAttemptReport appAttempt = GetApplicationAttempt(app.appReport.GetCurrentApplicationAttemptId
                                                                             (), false);
             app.appReport.SetHost(appAttempt.GetHost());
             app.appReport.SetRpcPort(appAttempt.GetRpcPort());
             app.appReport.SetTrackingUrl(appAttempt.GetTrackingUrl());
             app.appReport.SetOriginalTrackingUrl(appAttempt.GetOriginalTrackingUrl());
         }
     }
     catch (Exception)
     {
         // AuthorizationException is thrown because the user doesn't have access
         // It's possible that the app is finished before the first attempt is created.
         app.appReport.SetDiagnostics(null);
         app.appReport.SetCurrentApplicationAttemptId(null);
     }
     if (app.appReport.GetCurrentApplicationAttemptId() == null)
     {
         app.appReport.SetCurrentApplicationAttemptId(ApplicationAttemptId.NewInstance(app
                                                                                       .appReport.GetApplicationId(), -1));
     }
     if (app.appReport.GetHost() == null)
     {
         app.appReport.SetHost(Unavailable);
     }
     if (app.appReport.GetRpcPort() < 0)
     {
         app.appReport.SetRpcPort(-1);
     }
     if (app.appReport.GetTrackingUrl() == null)
     {
         app.appReport.SetTrackingUrl(Unavailable);
     }
     if (app.appReport.GetOriginalTrackingUrl() == null)
     {
         app.appReport.SetOriginalTrackingUrl(Unavailable);
     }
     if (app.appReport.GetDiagnostics() == null)
     {
         app.appReport.SetDiagnostics(string.Empty);
     }
     return(app);
 }
Пример #2
0
        /// <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);
        }
Пример #3
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();
     }
 }