Пример #1
0
        public virtual AppAttemptInfo GetAppAttempt(HttpServletRequest req, HttpServletResponse
                                                    res, string appId, string appAttemptId)
        {
            UserGroupInformation callerUGI = GetUser(req);
            ApplicationId        aid       = ParseApplicationId(appId);
            ApplicationAttemptId aaid      = ParseApplicationAttemptId(appAttemptId);

            ValidateIds(aid, aaid, null);
            ApplicationAttemptReport appAttempt = null;

            try
            {
                if (callerUGI == null)
                {
                    GetApplicationAttemptReportRequest request = GetApplicationAttemptReportRequest.NewInstance
                                                                     (aaid);
                    appAttempt = appBaseProt.GetApplicationAttemptReport(request).GetApplicationAttemptReport
                                     ();
                }
                else
                {
                    appAttempt = callerUGI.DoAs(new _PrivilegedExceptionAction_298(this, aaid));
                }
            }
            catch (Exception e)
            {
                RewrapAndThrowException(e);
            }
            if (appAttempt == null)
            {
                throw new NotFoundException("app attempt with id: " + appAttemptId + " not found"
                                            );
            }
            return(new AppAttemptInfo(appAttempt));
        }
Пример #2
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"/>
 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);
 }
 private ApplicationAttemptReport ConvertToApplicationAttemptReport(ApplicationAttemptHistoryData
                                                                    appAttemptHistory)
 {
     return(ApplicationAttemptReport.NewInstance(appAttemptHistory.GetApplicationAttemptId
                                                     (), appAttemptHistory.GetHost(), appAttemptHistory.GetRPCPort(), appAttemptHistory
                                                 .GetTrackingURL(), null, appAttemptHistory.GetDiagnosticsInfo(), appAttemptHistory
                                                 .GetYarnApplicationAttemptState(), appAttemptHistory.GetMasterContainerId()));
 }
Пример #5
0
        /// <exception cref="System.Exception"/>
        public virtual void TestGetApplicationAttemptReportOnHA()
        {
            ApplicationAttemptReport report = client.GetApplicationAttemptReport(cluster.CreateFakeApplicationAttemptId
                                                                                     ());

            NUnit.Framework.Assert.IsTrue(report != null);
            NUnit.Framework.Assert.AreEqual(cluster.CreateFakeApplicationAttemptReport(), report
                                            );
        }
        public static GetApplicationAttemptReportResponse NewInstance(ApplicationAttemptReport
                                                                      ApplicationAttemptReport)
        {
            GetApplicationAttemptReportResponse response = Org.Apache.Hadoop.Yarn.Util.Records
                                                           .NewRecord <GetApplicationAttemptReportResponse>();

            response.SetApplicationAttemptReport(ApplicationAttemptReport);
            return(response);
        }
Пример #7
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);
        }
 public override void SetApplicationAttemptReport(ApplicationAttemptReport ApplicationAttemptReport
                                                  )
 {
     MaybeInitBuilder();
     if (ApplicationAttemptReport == null)
     {
         builder.ClearApplicationAttemptReport();
     }
     this.applicationAttemptReport = ApplicationAttemptReport;
 }
Пример #9
0
        public virtual void TestApplicationAttemptReport()
        {
            ApplicationId        appId                 = ApplicationId.NewInstance(0, 1);
            ApplicationAttemptId appAttemptId          = ApplicationAttemptId.NewInstance(appId, 1);
            GetApplicationAttemptReportRequest request = GetApplicationAttemptReportRequest.NewInstance
                                                             (appAttemptId);
            GetApplicationAttemptReportResponse response = clientService.GetApplicationAttemptReport
                                                               (request);
            ApplicationAttemptReport attemptReport = response.GetApplicationAttemptReport();

            NUnit.Framework.Assert.IsNotNull(attemptReport);
            NUnit.Framework.Assert.AreEqual("appattempt_0_0001_000001", attemptReport.GetApplicationAttemptId
                                                ().ToString());
        }
Пример #10
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();
     }
 }
 public override ApplicationAttemptReport GetApplicationAttemptReport()
 {
     if (this.applicationAttemptReport != null)
     {
         return(this.applicationAttemptReport);
     }
     YarnServiceProtos.GetApplicationAttemptReportResponseProtoOrBuilder p = viaProto ?
                                                                             proto : builder;
     if (!p.HasApplicationAttemptReport())
     {
         return(null);
     }
     this.applicationAttemptReport = ConvertFromProtoFormat(p.GetApplicationAttemptReport
                                                                ());
     return(this.applicationAttemptReport);
 }
Пример #12
0
 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());
 }
Пример #13
0
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        /// <exception cref="System.IO.IOException"/>
        private ApplicationAttemptReport MonitorCurrentAppAttempt(ApplicationId appId, YarnApplicationAttemptState
                                                                  attemptState)
        {
            long startTime = Runtime.CurrentTimeMillis();
            ApplicationAttemptId attemptId = null;

            while (true)
            {
                if (attemptId == null)
                {
                    attemptId = rmClient.GetApplicationReport(appId).GetCurrentApplicationAttemptId();
                }
                ApplicationAttemptReport attemptReport = null;
                if (attemptId != null)
                {
                    attemptReport = rmClient.GetApplicationAttemptReport(attemptId);
                    if (attemptState.Equals(attemptReport.GetYarnApplicationAttemptState()))
                    {
                        return(attemptReport);
                    }
                }
                Log.Info("Current attempt state of " + appId + " is " + (attemptReport == null ?
                                                                         " N/A " : attemptReport.GetYarnApplicationAttemptState()) + ", waiting for current attempt to reach "
                         + attemptState);
                try
                {
                    Sharpen.Thread.Sleep(1000);
                }
                catch (Exception)
                {
                    Log.Warn("Interrupted while waiting for current attempt of " + appId + " to reach "
                             + attemptState);
                }
                if (Runtime.CurrentTimeMillis() - startTime > AmStateWaitTimeoutMs)
                {
                    string errmsg = "Timeout for waiting current attempt of " + appId + " to reach "
                                    + attemptState;
                    Log.Error(errmsg);
                    throw new RuntimeException(errmsg);
                }
            }
        }
Пример #14
0
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        /// <exception cref="System.IO.IOException"/>
        public virtual void TestGetApplicationAttempt()
        {
            Configuration conf   = new Configuration();
            AHSClient     client = new TestAHSClient.MockAHSClient();

            client.Init(conf);
            client.Start();
            IList <ApplicationReport> expectedReports = ((TestAHSClient.MockAHSClient)client).
                                                        GetReports();
            ApplicationId        applicationId = ApplicationId.NewInstance(1234, 5);
            ApplicationAttemptId appAttemptId  = ApplicationAttemptId.NewInstance(applicationId
                                                                                  , 1);
            ApplicationAttemptReport report = client.GetApplicationAttemptReport(appAttemptId
                                                                                 );

            NUnit.Framework.Assert.IsNotNull(report);
            NUnit.Framework.Assert.AreEqual(report.GetApplicationAttemptId().ToString(), expectedReports
                                            [0].GetCurrentApplicationAttemptId().ToString());
            client.Stop();
        }
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        /// <exception cref="System.IO.IOException"/>
        public virtual IDictionary <ApplicationAttemptId, ApplicationAttemptReport> GetApplicationAttempts
            (ApplicationId appId)
        {
            ApplicationHistoryManagerOnTimelineStore.ApplicationReportExt app = GetApplication
                                                                                    (appId, ApplicationHistoryManagerOnTimelineStore.ApplicationReportField.UserAndAcls
                                                                                    );
            CheckAccess(app);
            TimelineEntities entities = timelineDataManager.GetEntities(AppAttemptMetricsConstants
                                                                        .EntityType, new NameValuePair(AppAttemptMetricsConstants.ParentPrimaryFilter, appId
                                                                                                       .ToString()), null, null, null, null, null, long.MaxValue, EnumSet.AllOf <TimelineReader.Field
                                                                                                                                                                                 >(), UserGroupInformation.GetLoginUser());
            IDictionary <ApplicationAttemptId, ApplicationAttemptReport> appAttempts = new LinkedHashMap
                                                                                       <ApplicationAttemptId, ApplicationAttemptReport>();

            foreach (TimelineEntity entity in entities.GetEntities())
            {
                ApplicationAttemptReport appAttempt = ConvertToApplicationAttemptReport(entity);
                appAttempts[appAttempt.GetApplicationAttemptId()] = appAttempt;
            }
            return(appAttempts);
        }
Пример #16
0
 /// <exception cref="System.IO.IOException"/>
 /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
 public virtual bool Run()
 {
     Log.Info("Starting Client");
     // Connect to ResourceManager
     rmClient.Start();
     try
     {
         // Create launch context for app master
         Log.Info("Setting up application submission context for ASM");
         ApplicationSubmissionContext appContext = rmClient.CreateApplication().GetApplicationSubmissionContext
                                                       ();
         ApplicationId appId = appContext.GetApplicationId();
         // set the application name
         appContext.SetApplicationName(appName);
         // Set the priority for the application master
         Priority pri = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <Priority>();
         pri.SetPriority(amPriority);
         appContext.SetPriority(pri);
         // Set the queue to which this application is to be submitted in the RM
         appContext.SetQueue(amQueue);
         // Set up the container launch context for the application master
         ContainerLaunchContext amContainer = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord
                                              <ContainerLaunchContext>();
         appContext.SetAMContainerSpec(amContainer);
         // unmanaged AM
         appContext.SetUnmanagedAM(true);
         Log.Info("Setting unmanaged AM");
         // Submit the application to the applications manager
         Log.Info("Submitting application to ASM");
         rmClient.SubmitApplication(appContext);
         ApplicationReport appReport = MonitorApplication(appId, EnumSet.Of(YarnApplicationState
                                                                            .Accepted, YarnApplicationState.Killed, YarnApplicationState.Failed, YarnApplicationState
                                                                            .Finished));
         if (appReport.GetYarnApplicationState() == YarnApplicationState.Accepted)
         {
             // Monitor the application attempt to wait for launch state
             ApplicationAttemptReport attemptReport = MonitorCurrentAppAttempt(appId, YarnApplicationAttemptState
                                                                               .Launched);
             ApplicationAttemptId attemptId = attemptReport.GetApplicationAttemptId();
             Log.Info("Launching AM with application attempt id " + attemptId);
             // launch AM
             LaunchAM(attemptId);
             // Monitor the application for end state
             appReport = MonitorApplication(appId, EnumSet.Of(YarnApplicationState.Killed, YarnApplicationState
                                                              .Failed, YarnApplicationState.Finished));
         }
         YarnApplicationState   appState  = appReport.GetYarnApplicationState();
         FinalApplicationStatus appStatus = appReport.GetFinalApplicationStatus();
         Log.Info("App ended with state: " + appReport.GetYarnApplicationState() + " and status: "
                  + appStatus);
         bool success;
         if (YarnApplicationState.Finished == appState && FinalApplicationStatus.Succeeded
             == appStatus)
         {
             Log.Info("Application has completed successfully.");
             success = true;
         }
         else
         {
             Log.Info("Application did finished unsuccessfully." + " YarnState=" + appState.ToString
                          () + ", FinalStatus=" + appStatus.ToString());
             success = false;
         }
         return(success);
     }
     finally
     {
         rmClient.Stop();
     }
 }
        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));
        }
 private YarnProtos.ApplicationAttemptReportProto ConvertToProtoFormat(ApplicationAttemptReport
                                                                       t)
 {
     return(((ApplicationAttemptReportPBImpl)t).GetProto());
 }
Пример #19
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;
            }
 public abstract void SetApplicationAttemptReport(ApplicationAttemptReport applicationAttemptReport
                                                  );
        /// <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()));
        }
Пример #22
0
 public virtual ApplicationAttemptReport CreateFakeApplicationAttemptReport()
 {
     return(ApplicationAttemptReport.NewInstance(this.CreateFakeApplicationAttemptId()
                                                 , "localhost", 0, string.Empty, string.Empty, string.Empty, YarnApplicationAttemptState
                                                 .Running, this.CreateFakeContainerId()));
 }