Ejemplo n.º 1
0
        public virtual AppAttemptsInfo GetAppAttempts(HttpServletRequest req, HttpServletResponse
                                                      res, string appId)
        {
            UserGroupInformation callerUGI = GetUser(req);
            ApplicationId        id        = ParseApplicationId(appId);
            ICollection <ApplicationAttemptReport> appAttemptReports = null;

            try
            {
                if (callerUGI == null)
                {
                    GetApplicationAttemptsRequest request = GetApplicationAttemptsRequest.NewInstance
                                                                (id);
                    appAttemptReports = appBaseProt.GetApplicationAttempts(request).GetApplicationAttemptList
                                            ();
                }
                else
                {
                    appAttemptReports = callerUGI.DoAs(new _PrivilegedExceptionAction_260(this, id));
                }
            }
            catch (Exception e)
            {
                RewrapAndThrowException(e);
            }
            AppAttemptsInfo appAttemptsInfo = new AppAttemptsInfo();

            foreach (ApplicationAttemptReport appAttemptReport in appAttemptReports)
            {
                AppAttemptInfo appAttemptInfo = new AppAttemptInfo(appAttemptReport);
                appAttemptsInfo.Add(appAttemptInfo);
            }
            return(appAttemptsInfo);
        }
Ejemplo n.º 2
0
            /// <exception cref="System.Exception"/>
            public ICollection <ApplicationAttemptReport> Run()
            {
                GetApplicationAttemptsRequest request = GetApplicationAttemptsRequest.NewInstance
                                                            (id);

                return(this._enclosing.appBaseProt.GetApplicationAttempts(request).GetApplicationAttemptList
                           ());
            }
Ejemplo n.º 3
0
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        /// <exception cref="System.IO.IOException"/>
        public override IList <ApplicationAttemptReport> GetApplicationAttempts(ApplicationId
                                                                                appId)
        {
            GetApplicationAttemptsRequest request = GetApplicationAttemptsRequest.NewInstance
                                                        (appId);
            GetApplicationAttemptsResponse response = ahsClient.GetApplicationAttempts(request
                                                                                       );

            return(response.GetApplicationAttemptList());
        }
Ejemplo n.º 4
0
        public virtual void TestApplicationAttempts()
        {
            ApplicationId                 appId         = ApplicationId.NewInstance(0, 1);
            ApplicationAttemptId          appAttemptId  = ApplicationAttemptId.NewInstance(appId, 1);
            ApplicationAttemptId          appAttemptId1 = ApplicationAttemptId.NewInstance(appId, 2);
            GetApplicationAttemptsRequest request       = GetApplicationAttemptsRequest.NewInstance
                                                              (appId);
            GetApplicationAttemptsResponse response = clientService.GetApplicationAttempts(request
                                                                                           );
            IList <ApplicationAttemptReport> attemptReports = response.GetApplicationAttemptList
                                                                  ();

            NUnit.Framework.Assert.IsNotNull(attemptReports);
            NUnit.Framework.Assert.AreEqual(appAttemptId, attemptReports[0].GetApplicationAttemptId
                                                ());
            NUnit.Framework.Assert.AreEqual(appAttemptId1, attemptReports[1].GetApplicationAttemptId
                                                ());
        }
Ejemplo n.º 5
0
        protected override void Render(HtmlBlock.Block html)
        {
            string webUiType = $(YarnWebParams.WebUiType);
            string aid       = $(YarnWebParams.ApplicationId);

            if (aid.IsEmpty())
            {
                Puts("Bad request: requires Application ID");
                return;
            }
            try
            {
                appID = Apps.ToAppID(aid);
            }
            catch (Exception)
            {
                Puts("Invalid Application ID: " + aid);
                return;
            }
            UserGroupInformation callerUGI = GetCallerUGI();
            ApplicationReport    appReport;

            try
            {
                GetApplicationReportRequest request = GetApplicationReportRequest.NewInstance(appID
                                                                                              );
                if (callerUGI == null)
                {
                    appReport = appBaseProt.GetApplicationReport(request).GetApplicationReport();
                }
                else
                {
                    appReport = callerUGI.DoAs(new _PrivilegedExceptionAction_99(this, request));
                }
            }
            catch (Exception e)
            {
                string message = "Failed to read the application " + appID + ".";
                Log.Error(message, e);
                html.P().(message).();
                return;
            }
            if (appReport == null)
            {
                Puts("Application not found: " + aid);
                return;
            }
            AppInfo app = new AppInfo(appReport);

            SetTitle(StringHelper.Join("Application ", aid));
            if (webUiType != null && webUiType.Equals(YarnWebParams.RmWebUi) && conf.GetBoolean
                    (YarnConfiguration.RmWebappUiActionsEnabled, YarnConfiguration.DefaultRmWebappUiActionsEnabled
                    ))
            {
                // Application Kill
                html.Div().Button().$onclick("confirmAction()").B("Kill Application").().();
                StringBuilder script = new StringBuilder();
                script.Append("function confirmAction() {").Append(" b = confirm(\"Are you sure?\");"
                                                                   ).Append(" if (b == true) {").Append(" $.ajax({").Append(" type: 'PUT',").Append
                    (" url: '/ws/v1/cluster/apps/").Append(aid).Append("/state',").Append(" contentType: 'application/json',"
                                                                                          ).Append(" data: '{\"state\":\"KILLED\"}',").Append(" dataType: 'json'").Append(
                    " }).done(function(data){").Append(" setTimeout(function(){").Append(" location.href = '/cluster/app/"
                                                                                         ).Append(aid).Append("';").Append(" }, 1000);").Append(" }).fail(function(data){"
                                                                                                                                                ).Append(" console.log(data);").Append(" });").Append(" }").Append("}");
                html.Script().$type("text/javascript").(script.ToString()).();
            }
            Info("Application Overview").("User:"******"Name:", app.GetName()).("Application Type:"
                                                                                            , app.GetType()).("Application Tags:", app.GetApplicationTags() == null ? string.Empty
                                 : app.GetApplicationTags()).("YarnApplicationState:", app.GetAppState() == null
                                 ? Unavailable : ClarifyAppState(app.GetAppState())).("FinalStatus Reported by AM:"
                                                                                      , ClairfyAppFinalStatus(app.GetFinalAppStatus())).("Started:", Times.Format(app.
                                                                                                                                                                  GetStartedTime())).("Elapsed:", StringUtils.FormatTime(Times.Elapsed(app.GetStartedTime
                                                                                                                                                                                                                                           (), app.GetFinishedTime()))).("Tracking URL:", app.GetTrackingUrl() == null || app
                                                                                                                                                                                                                                                                         .GetTrackingUrl().Equals(Unavailable) ? null : Root_url(app.GetTrackingUrl()), app
                                                                                                                                                                                                                                                                         .GetTrackingUrl() == null || app.GetTrackingUrl().Equals(Unavailable) ? "Unassigned"
                                 : app.GetAppState() == YarnApplicationState.Finished || app.GetAppState() == YarnApplicationState
                                                                                                                                                                                                                                                                         .Failed || app.GetAppState() == YarnApplicationState.Killed ? "History" : "ApplicationMaster"
                                                                                                                                                                                                                                                                         ).("Diagnostics:", app.GetDiagnosticsInfo() == null ? string.Empty : app.GetDiagnosticsInfo
                                                                                                                                                                                                                                                                                ());
            ICollection <ApplicationAttemptReport> attempts;

            try
            {
                GetApplicationAttemptsRequest request = GetApplicationAttemptsRequest.NewInstance
                                                            (appID);
                if (callerUGI == null)
                {
                    attempts = appBaseProt.GetApplicationAttempts(request).GetApplicationAttemptList(
                        );
                }
                else
                {
                    attempts = callerUGI.DoAs(new _PrivilegedExceptionAction_196(this, request));
                }
            }
            catch (Exception e)
            {
                string message = "Failed to read the attempts of the application " + appID + ".";
                Log.Error(message, e);
                html.P().(message).();
                return;
            }
            CreateApplicationMetricsTable(html);
            html.(typeof(InfoBlock));
            GenerateApplicationTable(html, callerUGI, attempts);
        }