Beispiel #1
0
 public AppInfo(ApplicationReport app)
 {
     // JAXB needs this
     appId = app.GetApplicationId().ToString();
     if (app.GetCurrentApplicationAttemptId() != null)
     {
         currentAppAttemptId = app.GetCurrentApplicationAttemptId().ToString();
     }
     user                = app.GetUser();
     queue               = app.GetQueue();
     name                = app.GetName();
     type                = app.GetApplicationType();
     host                = app.GetHost();
     rpcPort             = app.GetRpcPort();
     appState            = app.GetYarnApplicationState();
     diagnosticsInfo     = app.GetDiagnostics();
     trackingUrl         = app.GetTrackingUrl();
     originalTrackingUrl = app.GetOriginalTrackingUrl();
     submittedTime       = app.GetStartTime();
     startedTime         = app.GetStartTime();
     finishedTime        = app.GetFinishTime();
     elapsedTime         = Times.Elapsed(startedTime, finishedTime);
     finalAppStatus      = app.GetFinalApplicationStatus();
     progress            = app.GetProgress() * 100;
     // in percent
     if (app.GetApplicationTags() != null && !app.GetApplicationTags().IsEmpty())
     {
         this.applicationTags = StringHelper.CsvJoiner.Join(app.GetApplicationTags());
     }
 }
        public virtual void TestApplicationReport()
        {
            ApplicationId appId = null;

            appId = ApplicationId.NewInstance(0, 1);
            WriteApplicationStartData(appId);
            WriteApplicationFinishData(appId);
            ApplicationAttemptId appAttemptId = ApplicationAttemptId.NewInstance(appId, 1);

            WriteApplicationAttemptStartData(appAttemptId);
            WriteApplicationAttemptFinishData(appAttemptId);
            ApplicationReport appReport = applicationHistoryManagerImpl.GetApplication(appId);

            NUnit.Framework.Assert.IsNotNull(appReport);
            NUnit.Framework.Assert.AreEqual(appId, appReport.GetApplicationId());
            NUnit.Framework.Assert.AreEqual(appAttemptId, appReport.GetCurrentApplicationAttemptId
                                                ());
            NUnit.Framework.Assert.AreEqual(appAttemptId.ToString(), appReport.GetHost());
            NUnit.Framework.Assert.AreEqual("test type", appReport.GetApplicationType().ToString
                                                ());
            NUnit.Framework.Assert.AreEqual("test queue", appReport.GetQueue().ToString());
        }
Beispiel #3
0
        public virtual void TestApplicationReport()
        {
            ApplicationId appId = null;

            appId = ApplicationId.NewInstance(0, 1);
            GetApplicationReportRequest request = GetApplicationReportRequest.NewInstance(appId
                                                                                          );
            GetApplicationReportResponse response = clientService.GetApplicationReport(request
                                                                                       );
            ApplicationReport appReport = response.GetApplicationReport();

            NUnit.Framework.Assert.IsNotNull(appReport);
            NUnit.Framework.Assert.AreEqual(123, appReport.GetApplicationResourceUsageReport(
                                                ).GetMemorySeconds());
            NUnit.Framework.Assert.AreEqual(345, appReport.GetApplicationResourceUsageReport(
                                                ).GetVcoreSeconds());
            NUnit.Framework.Assert.AreEqual("application_0_0001", appReport.GetApplicationId(
                                                ).ToString());
            NUnit.Framework.Assert.AreEqual("test app type", appReport.GetApplicationType().ToString
                                                ());
            NUnit.Framework.Assert.AreEqual("test queue", appReport.GetQueue().ToString());
        }
Beispiel #4
0
        /// <summary>Prints the application report for an application id.</summary>
        /// <param name="applicationId"/>
        /// <returns>exitCode</returns>
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        /// <exception cref="System.IO.IOException"/>
        private int PrintApplicationReport(string applicationId)
        {
            ApplicationReport appReport = null;

            try
            {
                appReport = client.GetApplicationReport(ConverterUtils.ToApplicationId(applicationId
                                                                                       ));
            }
            catch (ApplicationNotFoundException)
            {
                sysout.WriteLine("Application with id '" + applicationId + "' doesn't exist in RM or Timeline Server."
                                 );
                return(-1);
            }
            // Use PrintWriter.println, which uses correct platform line ending.
            ByteArrayOutputStream baos         = new ByteArrayOutputStream();
            PrintWriter           appReportStr = new PrintWriter(new OutputStreamWriter(baos, Sharpen.Extensions.GetEncoding
                                                                                            ("UTF-8")));

            if (appReport != null)
            {
                appReportStr.WriteLine("Application Report : ");
                appReportStr.Write("\tApplication-Id : ");
                appReportStr.WriteLine(appReport.GetApplicationId());
                appReportStr.Write("\tApplication-Name : ");
                appReportStr.WriteLine(appReport.GetName());
                appReportStr.Write("\tApplication-Type : ");
                appReportStr.WriteLine(appReport.GetApplicationType());
                appReportStr.Write("\tUser : "******"\tQueue : ");
                appReportStr.WriteLine(appReport.GetQueue());
                appReportStr.Write("\tStart-Time : ");
                appReportStr.WriteLine(appReport.GetStartTime());
                appReportStr.Write("\tFinish-Time : ");
                appReportStr.WriteLine(appReport.GetFinishTime());
                appReportStr.Write("\tProgress : ");
                DecimalFormat formatter = new DecimalFormat("###.##%");
                string        progress  = formatter.Format(appReport.GetProgress());
                appReportStr.WriteLine(progress);
                appReportStr.Write("\tState : ");
                appReportStr.WriteLine(appReport.GetYarnApplicationState());
                appReportStr.Write("\tFinal-State : ");
                appReportStr.WriteLine(appReport.GetFinalApplicationStatus());
                appReportStr.Write("\tTracking-URL : ");
                appReportStr.WriteLine(appReport.GetOriginalTrackingUrl());
                appReportStr.Write("\tRPC Port : ");
                appReportStr.WriteLine(appReport.GetRpcPort());
                appReportStr.Write("\tAM Host : ");
                appReportStr.WriteLine(appReport.GetHost());
                appReportStr.Write("\tAggregate Resource Allocation : ");
                ApplicationResourceUsageReport usageReport = appReport.GetApplicationResourceUsageReport
                                                                 ();
                if (usageReport != null)
                {
                    //completed app report in the timeline server doesn't have usage report
                    appReportStr.Write(usageReport.GetMemorySeconds() + " MB-seconds, ");
                    appReportStr.WriteLine(usageReport.GetVcoreSeconds() + " vcore-seconds");
                }
                else
                {
                    appReportStr.WriteLine("N/A");
                }
                appReportStr.Write("\tDiagnostics : ");
                appReportStr.Write(appReport.GetDiagnostics());
            }
            else
            {
                appReportStr.Write("Application with id '" + applicationId + "' doesn't exist in RM."
                                   );
                appReportStr.Close();
                sysout.WriteLine(baos.ToString("UTF-8"));
                return(-1);
            }
            appReportStr.Close();
            sysout.WriteLine(baos.ToString("UTF-8"));
            return(0);
        }