private ApplicationAttemptReport ConvertToApplicationAttemptReport(ApplicationAttemptHistoryData
                                                                    appAttemptHistory)
 {
     return(ApplicationAttemptReport.NewInstance(appAttemptHistory.GetApplicationAttemptId
                                                     (), appAttemptHistory.GetHost(), appAttemptHistory.GetRPCPort(), appAttemptHistory
                                                 .GetTrackingURL(), null, appAttemptHistory.GetDiagnosticsInfo(), appAttemptHistory
                                                 .GetYarnApplicationAttemptState(), appAttemptHistory.GetMasterContainerId()));
 }
        private static ApplicationAttemptReport ConvertToApplicationAttemptReport(TimelineEntity
                                                                                  entity)
        {
            string      host                   = null;
            int         rpcPort                = -1;
            ContainerId amContainerId          = null;
            string      trackingUrl            = null;
            string      originalTrackingUrl    = null;
            string      diagnosticsInfo        = null;
            YarnApplicationAttemptState state  = null;
            IList <TimelineEvent>       events = entity.GetEvents();

            if (events != null)
            {
                foreach (TimelineEvent @event in events)
                {
                    if (@event.GetEventType().Equals(AppAttemptMetricsConstants.RegisteredEventType))
                    {
                        IDictionary <string, object> eventInfo = @event.GetEventInfo();
                        if (eventInfo == null)
                        {
                            continue;
                        }
                        if (eventInfo.Contains(AppAttemptMetricsConstants.HostEventInfo))
                        {
                            host = eventInfo[AppAttemptMetricsConstants.HostEventInfo].ToString();
                        }
                        if (eventInfo.Contains(AppAttemptMetricsConstants.RpcPortEventInfo))
                        {
                            rpcPort = (int)eventInfo[AppAttemptMetricsConstants.RpcPortEventInfo];
                        }
                        if (eventInfo.Contains(AppAttemptMetricsConstants.MasterContainerEventInfo))
                        {
                            amContainerId = ConverterUtils.ToContainerId(eventInfo[AppAttemptMetricsConstants
                                                                                   .MasterContainerEventInfo].ToString());
                        }
                    }
                    else
                    {
                        if (@event.GetEventType().Equals(AppAttemptMetricsConstants.FinishedEventType))
                        {
                            IDictionary <string, object> eventInfo = @event.GetEventInfo();
                            if (eventInfo == null)
                            {
                                continue;
                            }
                            if (eventInfo.Contains(AppAttemptMetricsConstants.TrackingUrlEventInfo))
                            {
                                trackingUrl = eventInfo[AppAttemptMetricsConstants.TrackingUrlEventInfo].ToString
                                                  ();
                            }
                            if (eventInfo.Contains(AppAttemptMetricsConstants.OriginalTrackingUrlEventInfo))
                            {
                                originalTrackingUrl = eventInfo[AppAttemptMetricsConstants.OriginalTrackingUrlEventInfo
                                                      ].ToString();
                            }
                            if (eventInfo.Contains(AppAttemptMetricsConstants.DiagnosticsInfoEventInfo))
                            {
                                diagnosticsInfo = eventInfo[AppAttemptMetricsConstants.DiagnosticsInfoEventInfo].
                                                  ToString();
                            }
                            if (eventInfo.Contains(AppAttemptMetricsConstants.StateEventInfo))
                            {
                                state = YarnApplicationAttemptState.ValueOf(eventInfo[AppAttemptMetricsConstants.
                                                                                      StateEventInfo].ToString());
                            }
                        }
                    }
                }
            }
            return(ApplicationAttemptReport.NewInstance(ConverterUtils.ToApplicationAttemptId
                                                            (entity.GetEntityId()), host, rpcPort, trackingUrl, originalTrackingUrl, diagnosticsInfo
                                                        , state, amContainerId));
        }
 public virtual ApplicationAttemptReport CreateFakeApplicationAttemptReport()
 {
     return(ApplicationAttemptReport.NewInstance(this.CreateFakeApplicationAttemptId()
                                                 , "localhost", 0, string.Empty, string.Empty, string.Empty, YarnApplicationAttemptState
                                                 .Running, this.CreateFakeContainerId()));
 }
Beispiel #4
0
            private void CreateAppReports()
            {
                ApplicationId     applicationId        = ApplicationId.NewInstance(1234, 5);
                ApplicationReport newApplicationReport = ApplicationReport.NewInstance(applicationId
                                                                                       , ApplicationAttemptId.NewInstance(applicationId, 1), "user", "queue", "appname"
                                                                                       , "host", 124, null, YarnApplicationState.Running, "diagnostics", "url", 0, 0, FinalApplicationStatus
                                                                                       .Succeeded, null, "N/A", 0.53789f, "YARN", null);
                IList <ApplicationReport> applicationReports = new AList <ApplicationReport>();

                applicationReports.AddItem(newApplicationReport);
                IList <ApplicationAttemptReport> appAttempts = new AList <ApplicationAttemptReport>
                                                                   ();
                ApplicationAttemptReport attempt = ApplicationAttemptReport.NewInstance(ApplicationAttemptId
                                                                                        .NewInstance(applicationId, 1), "host", 124, "url", "oUrl", "diagnostics", YarnApplicationAttemptState
                                                                                        .Finished, ContainerId.NewContainerId(newApplicationReport.GetCurrentApplicationAttemptId
                                                                                                                                  (), 1));

                appAttempts.AddItem(attempt);
                ApplicationAttemptReport attempt1 = ApplicationAttemptReport.NewInstance(ApplicationAttemptId
                                                                                         .NewInstance(applicationId, 2), "host", 124, "url", "oUrl", "diagnostics", YarnApplicationAttemptState
                                                                                         .Finished, ContainerId.NewContainerId(newApplicationReport.GetCurrentApplicationAttemptId
                                                                                                                                   (), 2));

                appAttempts.AddItem(attempt1);
                attempts[applicationId] = appAttempts;
                IList <ContainerReport> containerReports = new AList <ContainerReport>();
                ContainerReport         container        = ContainerReport.NewInstance(ContainerId.NewContainerId
                                                                                           (attempt.GetApplicationAttemptId(), 1), null, NodeId.NewInstance("host", 1234),
                                                                                       Priority.Undefined, 1234, 5678, "diagnosticInfo", "logURL", 0, ContainerState.Complete
                                                                                       , "http://" + NodeId.NewInstance("host", 2345).ToString());

                containerReports.AddItem(container);
                ContainerReport container1 = ContainerReport.NewInstance(ContainerId.NewContainerId
                                                                             (attempt.GetApplicationAttemptId(), 2), null, NodeId.NewInstance("host", 1234),
                                                                         Priority.Undefined, 1234, 5678, "diagnosticInfo", "logURL", 0, ContainerState.Complete
                                                                         , "http://" + NodeId.NewInstance("host", 2345).ToString());

                containerReports.AddItem(container1);
                containers[attempt.GetApplicationAttemptId()] = containerReports;
                ApplicationId     applicationId2        = ApplicationId.NewInstance(1234, 6);
                ApplicationReport newApplicationReport2 = ApplicationReport.NewInstance(applicationId2
                                                                                        , ApplicationAttemptId.NewInstance(applicationId2, 2), "user2", "queue2", "appname2"
                                                                                        , "host2", 125, null, YarnApplicationState.Finished, "diagnostics2", "url2", 2,
                                                                                        2, FinalApplicationStatus.Succeeded, null, "N/A", 0.63789f, "NON-YARN", null);

                applicationReports.AddItem(newApplicationReport2);
                ApplicationId     applicationId3        = ApplicationId.NewInstance(1234, 7);
                ApplicationReport newApplicationReport3 = ApplicationReport.NewInstance(applicationId3
                                                                                        , ApplicationAttemptId.NewInstance(applicationId3, 3), "user3", "queue3", "appname3"
                                                                                        , "host3", 126, null, YarnApplicationState.Running, "diagnostics3", "url3", 3, 3
                                                                                        , FinalApplicationStatus.Succeeded, null, "N/A", 0.73789f, "MAPREDUCE", null);

                applicationReports.AddItem(newApplicationReport3);
                ApplicationId     applicationId4        = ApplicationId.NewInstance(1234, 8);
                ApplicationReport newApplicationReport4 = ApplicationReport.NewInstance(applicationId4
                                                                                        , ApplicationAttemptId.NewInstance(applicationId4, 4), "user4", "queue4", "appname4"
                                                                                        , "host4", 127, null, YarnApplicationState.Failed, "diagnostics4", "url4", 4, 4,
                                                                                        FinalApplicationStatus.Succeeded, null, "N/A", 0.83789f, "NON-MAPREDUCE", null);

                applicationReports.AddItem(newApplicationReport4);
                reports = applicationReports;
            }