Example #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());
     }
 }
Example #2
0
        public TaskInfo(Task task)
        {
            TaskType ttype = task.GetType();

            this.type = ttype.ToString();
            TaskReport report = task.GetReport();

            this.startTime   = report.GetStartTime();
            this.finishTime  = report.GetFinishTime();
            this.state       = report.GetTaskState();
            this.elapsedTime = Times.Elapsed(this.startTime, this.finishTime, this.state == TaskState
                                             .Running);
            if (this.elapsedTime == -1)
            {
                this.elapsedTime = 0;
            }
            this.progress   = report.GetProgress() * 100;
            this.status     = report.GetStatus();
            this.id         = MRApps.ToString(task.GetID());
            this.taskNum    = task.GetID().GetId();
            this.successful = GetSuccessfulAttempt(task);
            if (successful != null)
            {
                this.successfulAttempt = MRApps.ToString(successful.GetID());
            }
            else
            {
                this.successfulAttempt = string.Empty;
            }
        }
Example #3
0
 public AppInfo(Org.Apache.Hadoop.Mapreduce.V2.App.Webapp.App app, AppContext context
                )
 {
     this.appId       = context.GetApplicationID().ToString();
     this.name        = context.GetApplicationName().ToString();
     this.user        = context.GetUser().ToString();
     this.startedOn   = context.GetStartTime();
     this.elapsedTime = Times.Elapsed(this.startedOn, 0);
 }
Example #4
0
        public JobInfo(Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job job, bool hasAccess)
        {
            // ok for any user to see
            // these should only be seen if acls allow
            this.id = MRApps.ToString(job.GetID());
            JobReport report = job.GetReport();

            this.startTime   = report.GetStartTime();
            this.finishTime  = report.GetFinishTime();
            this.elapsedTime = Times.Elapsed(this.startTime, this.finishTime);
            if (this.elapsedTime == -1)
            {
                this.elapsedTime = 0;
            }
            this.name                  = job.GetName().ToString();
            this.user                  = job.GetUserName();
            this.state                 = job.GetState();
            this.mapsTotal             = job.GetTotalMaps();
            this.mapsCompleted         = job.GetCompletedMaps();
            this.mapProgress           = report.GetMapProgress() * 100;
            this.mapProgressPercent    = StringHelper.Percent(report.GetMapProgress());
            this.reducesTotal          = job.GetTotalReduces();
            this.reducesCompleted      = job.GetCompletedReduces();
            this.reduceProgress        = report.GetReduceProgress() * 100;
            this.reduceProgressPercent = StringHelper.Percent(report.GetReduceProgress());
            this.acls                  = new AList <ConfEntryInfo>();
            if (hasAccess)
            {
                this.diagnostics = string.Empty;
                CountTasksAndAttempts(job);
                this.uberized = job.IsUber();
                IList <string> diagnostics = job.GetDiagnostics();
                if (diagnostics != null && !diagnostics.IsEmpty())
                {
                    StringBuilder b = new StringBuilder();
                    foreach (string diag in diagnostics)
                    {
                        b.Append(diag);
                    }
                    this.diagnostics = b.ToString();
                }
                IDictionary <JobACL, AccessControlList> allacls = job.GetJobACLs();
                if (allacls != null)
                {
                    foreach (KeyValuePair <JobACL, AccessControlList> entry in allacls)
                    {
                        this.acls.AddItem(new ConfEntryInfo(entry.Key.GetAclName(), entry.Value.GetAclString
                                                                ()));
                    }
                }
            }
        }
Example #5
0
        public TaskAttemptInfo(TaskAttempt ta, TaskType type, bool isRunning)
        {
            TaskAttemptReport report = ta.GetReport();

            this.type                = type.ToString();
            this.id                  = MRApps.ToString(ta.GetID());
            this.nodeHttpAddress     = ta.GetNodeHttpAddress();
            this.startTime           = report.GetStartTime();
            this.finishTime          = report.GetFinishTime();
            this.assignedContainerId = ConverterUtils.ToString(report.GetContainerId());
            this.assignedContainer   = report.GetContainerId();
            this.progress            = report.GetProgress() * 100;
            this.status              = report.GetStateString();
            this.state               = report.GetTaskAttemptState();
            this.elapsedTime         = Times.Elapsed(this.startTime, this.finishTime, isRunning);
            if (this.elapsedTime == -1)
            {
                this.elapsedTime = 0;
            }
            this.diagnostics = report.GetDiagnosticInfo();
            this.rack        = ta.GetNodeRackName();
        }
Example #6
0
 public ContainerInfo(ContainerReport container)
 {
     // JAXB needs this
     containerId = container.GetContainerId().ToString();
     if (container.GetAllocatedResource() != null)
     {
         allocatedMB     = container.GetAllocatedResource().GetMemory();
         allocatedVCores = container.GetAllocatedResource().GetVirtualCores();
     }
     if (container.GetAssignedNode() != null)
     {
         assignedNodeId = container.GetAssignedNode().ToString();
     }
     priority            = container.GetPriority().GetPriority();
     startedTime         = container.GetCreationTime();
     finishedTime        = container.GetFinishTime();
     elapsedTime         = Times.Elapsed(startedTime, finishedTime);
     diagnosticsInfo     = container.GetDiagnosticsInfo();
     logUrl              = container.GetLogUrl();
     containerExitStatus = container.GetContainerExitStatus();
     containerState      = container.GetContainerState();
     nodeHttpAddress     = container.GetNodeHttpAddress();
 }
Example #7
0
 public ReduceTaskAttemptInfo(TaskAttempt ta, TaskType type)
     : base(ta, type, false)
 {
     this.shuffleFinishTime  = ta.GetShuffleFinishTime();
     this.mergeFinishTime    = ta.GetSortFinishTime();
     this.elapsedShuffleTime = Times.Elapsed(this.startTime, this.shuffleFinishTime, false
                                             );
     if (this.elapsedShuffleTime == -1)
     {
         this.elapsedShuffleTime = 0;
     }
     this.elapsedMergeTime = Times.Elapsed(this.shuffleFinishTime, this.mergeFinishTime
                                           , false);
     if (this.elapsedMergeTime == -1)
     {
         this.elapsedMergeTime = 0;
     }
     this.elapsedReduceTime = Times.Elapsed(this.mergeFinishTime, this.finishTime, false
                                            );
     if (this.elapsedReduceTime == -1)
     {
         this.elapsedReduceTime = 0;
     }
 }
Example #8
0
 public AppInfo(ResourceManager rm, RMApp app, bool hasAccess, string schemePrefix
                )
 {
     // these are ok for any user to see
     // these are only allowed if acls allow
     // preemption info fields
     // JAXB needs this
     this.schemePrefix = schemePrefix;
     if (app != null)
     {
         string trackingUrl = app.GetTrackingUrl();
         this.state = app.CreateApplicationState();
         this.trackingUrlIsNotReady = trackingUrl == null || trackingUrl.IsEmpty() || YarnApplicationState
                                      .New == this.state || YarnApplicationState.NewSaving == this.state || YarnApplicationState
                                      .Submitted == this.state || YarnApplicationState.Accepted == this.state;
         this.trackingUI = this.trackingUrlIsNotReady ? "UNASSIGNED" : (app.GetFinishTime(
                                                                            ) == 0 ? "ApplicationMaster" : "History");
         if (!trackingUrlIsNotReady)
         {
             this.trackingUrl       = WebAppUtils.GetURLWithScheme(schemePrefix, trackingUrl);
             this.trackingUrlPretty = this.trackingUrl;
         }
         else
         {
             this.trackingUrlPretty = "UNASSIGNED";
         }
         this.applicationId   = app.GetApplicationId();
         this.applicationType = app.GetApplicationType();
         this.appIdNum        = app.GetApplicationId().GetId().ToString();
         this.id          = app.GetApplicationId().ToString();
         this.user        = app.GetUser().ToString();
         this.name        = app.GetName().ToString();
         this.queue       = app.GetQueue().ToString();
         this.progress    = app.GetProgress() * 100;
         this.diagnostics = app.GetDiagnostics().ToString();
         if (diagnostics == null || diagnostics.IsEmpty())
         {
             this.diagnostics = string.Empty;
         }
         if (app.GetApplicationTags() != null && !app.GetApplicationTags().IsEmpty())
         {
             this.applicationTags = Joiner.On(',').Join(app.GetApplicationTags());
         }
         this.finalStatus = app.GetFinalApplicationStatus();
         this.clusterId   = ResourceManager.GetClusterTimeStamp();
         if (hasAccess)
         {
             this.startedTime  = app.GetStartTime();
             this.finishedTime = app.GetFinishTime();
             this.elapsedTime  = Times.Elapsed(app.GetStartTime(), app.GetFinishTime());
             RMAppAttempt attempt = app.GetCurrentAppAttempt();
             if (attempt != null)
             {
                 Container masterContainer = attempt.GetMasterContainer();
                 if (masterContainer != null)
                 {
                     this.amContainerLogsExist = true;
                     this.amContainerLogs      = WebAppUtils.GetRunningLogURL(schemePrefix + masterContainer
                                                                              .GetNodeHttpAddress(), ConverterUtils.ToString(masterContainer.GetId()), app.GetUser
                                                                                  ());
                     this.amHostHttpAddress = masterContainer.GetNodeHttpAddress();
                 }
                 ApplicationResourceUsageReport resourceReport = attempt.GetApplicationResourceUsageReport
                                                                     ();
                 if (resourceReport != null)
                 {
                     Resource usedResources = resourceReport.GetUsedResources();
                     allocatedMB       = usedResources.GetMemory();
                     allocatedVCores   = usedResources.GetVirtualCores();
                     runningContainers = resourceReport.GetNumUsedContainers();
                 }
                 resourceRequests = ((AbstractYarnScheduler)rm.GetRMContext().GetScheduler()).GetPendingResourceRequestsForAttempt
                                        (attempt.GetAppAttemptId());
             }
         }
         // copy preemption info fields
         RMAppMetrics appMetrics = app.GetRMAppMetrics();
         numAMContainerPreempted    = appMetrics.GetNumAMContainersPreempted();
         preemptedResourceMB        = appMetrics.GetResourcePreempted().GetMemory();
         numNonAMContainerPreempted = appMetrics.GetNumNonAMContainersPreempted();
         preemptedResourceVCores    = appMetrics.GetResourcePreempted().GetVirtualCores();
         memorySeconds = appMetrics.GetMemorySeconds();
         vcoreSeconds  = appMetrics.GetVcoreSeconds();
     }
 }
Example #9
0
            protected override void Render(HtmlBlock.Block html)
            {
                if (!IsValidRequest())
                {
                    html.H2($(Title));
                    return;
                }
                TaskType type   = null;
                string   symbol = $(AMParams.TaskType);

                if (!symbol.IsEmpty())
                {
                    type = MRApps.TaskType(symbol);
                }
                else
                {
                    type = app.GetTask().GetType();
                }
                Hamlet.TR <Hamlet.THEAD <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> >
                           > headRow = html.Table("#attempts").Thead().Tr();
                headRow.Th(".id", "Attempt").Th(".state", "State").Th(".status", "Status").Th(".node"
                                                                                              , "Node").Th(".logs", "Logs").Th(".tsh", "Start Time");
                if (type == TaskType.Reduce)
                {
                    headRow.Th("Shuffle Finish Time");
                    headRow.Th("Merge Finish Time");
                }
                headRow.Th("Finish Time");
                //Attempt
                if (type == TaskType.Reduce)
                {
                    headRow.Th("Elapsed Time Shuffle");
                    //Attempt
                    headRow.Th("Elapsed Time Merge");
                    //Attempt
                    headRow.Th("Elapsed Time Reduce");
                }
                //Attempt
                headRow.Th("Elapsed Time").Th(".note", "Note");
                Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = headRow
                                                                                                   .().().Tbody();
                // Write all the data into a JavaScript array of arrays for JQuery
                // DataTables to display
                StringBuilder attemptsTableData = new StringBuilder("[\n");

                foreach (TaskAttempt attempt in GetTaskAttempts())
                {
                    TaskAttemptInfo ta                 = new TaskAttemptInfo(attempt, false);
                    string          taid               = ta.GetId();
                    string          nodeHttpAddr       = ta.GetNode();
                    string          containerIdString  = ta.GetAssignedContainerIdStr();
                    string          nodeIdString       = attempt.GetAssignedContainerMgrAddress();
                    string          nodeRackName       = ta.GetRack();
                    long            attemptStartTime   = ta.GetStartTime();
                    long            shuffleFinishTime  = -1;
                    long            sortFinishTime     = -1;
                    long            attemptFinishTime  = ta.GetFinishTime();
                    long            elapsedShuffleTime = -1;
                    long            elapsedSortTime    = -1;
                    long            elapsedReduceTime  = -1;
                    if (type == TaskType.Reduce)
                    {
                        shuffleFinishTime  = attempt.GetShuffleFinishTime();
                        sortFinishTime     = attempt.GetSortFinishTime();
                        elapsedShuffleTime = Times.Elapsed(attemptStartTime, shuffleFinishTime, false);
                        elapsedSortTime    = Times.Elapsed(shuffleFinishTime, sortFinishTime, false);
                        elapsedReduceTime  = Times.Elapsed(sortFinishTime, attemptFinishTime, false);
                    }
                    long attemptElapsed = Times.Elapsed(attemptStartTime, attemptFinishTime, false);
                    int  sortId         = attempt.GetID().GetId() + (attempt.GetID().GetTaskId().GetId() * 10000
                                                                     );
                    attemptsTableData.Append("[\"").Append(sortId + " ").Append(taid).Append("\",\"")
                    .Append(ta.GetState()).Append("\",\"").Append(StringEscapeUtils.EscapeJavaScript
                                                                      (StringEscapeUtils.EscapeHtml(ta.GetStatus()))).Append("\",\"").Append("<a class='nodelink' href='"
                                                                                                                                             + MRWebAppUtil.GetYARNWebappScheme() + nodeHttpAddr + "'>").Append(nodeRackName
                                                                                                                                                                                                                + "/" + nodeHttpAddr + "</a>\",\"").Append("<a class='logslink' href='").Append
                        (Url("logs", nodeIdString, containerIdString, taid, app.GetJob().GetUserName()))
                    .Append("'>logs</a>\",\"").Append(attemptStartTime).Append("\",\"");
                    if (type == TaskType.Reduce)
                    {
                        attemptsTableData.Append(shuffleFinishTime).Append("\",\"").Append(sortFinishTime
                                                                                           ).Append("\",\"");
                    }
                    attemptsTableData.Append(attemptFinishTime).Append("\",\"");
                    if (type == TaskType.Reduce)
                    {
                        attemptsTableData.Append(elapsedShuffleTime).Append("\",\"").Append(elapsedSortTime
                                                                                            ).Append("\",\"").Append(elapsedReduceTime).Append("\",\"");
                    }
                    attemptsTableData.Append(attemptElapsed).Append("\",\"").Append(StringEscapeUtils
                                                                                    .EscapeJavaScript(StringEscapeUtils.EscapeHtml(ta.GetNote()))).Append("\"],\n");
                }
                //Remove the last comma and close off the array of arrays
                if (attemptsTableData[attemptsTableData.Length - 2] == ',')
                {
                    attemptsTableData.Delete(attemptsTableData.Length - 2, attemptsTableData.Length -
                                             1);
                }
                attemptsTableData.Append("]");
                html.Script().$type("text/javascript").("var attemptsTableData=" + attemptsTableData
                                                        ).();
                Hamlet.TR <Hamlet.TFOOT <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> >
                           > footRow = tbody.().Tfoot().Tr();
                footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("attempt_name"
                                                                                         ).$value("Attempt").().().Th().Input("search_init").$type(HamletSpec.InputType.text
                                                                                                                                                   ).$name("attempt_state").$value("State").().().Th().Input("search_init").$type(HamletSpec.InputType
                                                                                                                                                                                                                                  .text).$name("attempt_status").$value("Status").().().Th().Input("search_init").
                $type(HamletSpec.InputType.text).$name("attempt_node").$value("Node").().().Th()
                .Input("search_init").$type(HamletSpec.InputType.text).$name("attempt_node").$value
                    ("Logs").().().Th().Input("search_init").$type(HamletSpec.InputType.text).$name(
                    "attempt_start_time").$value("Start Time").().();
                if (type == TaskType.Reduce)
                {
                    footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("shuffle_time"
                                                                                             ).$value("Shuffle Time").().();
                    footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("merge_time"
                                                                                             ).$value("Merge Time").().();
                }
                footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("attempt_finish"
                                                                                         ).$value("Finish Time").().();
                if (type == TaskType.Reduce)
                {
                    footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("elapsed_shuffle_time"
                                                                                             ).$value("Elapsed Shuffle Time").().();
                    footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("elapsed_merge_time"
                                                                                             ).$value("Elapsed Merge Time").().();
                    footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("elapsed_reduce_time"
                                                                                             ).$value("Elapsed Reduce Time").().();
                }
                footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("attempt_elapsed"
                                                                                         ).$value("Elapsed Time").().().Th().Input("search_init").$type(HamletSpec.InputType
                                                                                                                                                        .text).$name("note").$value("Note").().();
                footRow.().().();
            }
Example #10
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);
        }
Example #11
0
        /*
         * (non-Javadoc)
         * @see org.apache.hadoop.yarn.webapp.view.HtmlBlock#render(org.apache.hadoop.yarn.webapp.view.HtmlBlock.Block)
         */
        protected override void Render(HtmlBlock.Block html)
        {
            string jid = $(AMParams.JobId);

            if (jid.IsEmpty())
            {
                html.P().("Sorry, can't do anything without a JobID.").();
                return;
            }
            JobId jobID = MRApps.ToJobID(jid);

            Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job j = appContext.GetJob(jobID);
            if (j == null)
            {
                html.P().("Sorry, ", jid, " not found.").();
                return;
            }
            IList <AMInfo> amInfos   = j.GetAMInfos();
            JobInfo        job       = new JobInfo(j);
            ResponseInfo   infoBlock = Info("Job Overview").("Job Name:", job.GetName()).("User Name:"
                                                                                          , job.GetUserName()).("Queue:", job.GetQueueName()).("State:", job.GetState()).(
                "Uberized:", job.IsUber()).("Submitted:", Sharpen.Extensions.CreateDate(job.GetSubmitTime
                                                                                            ())).("Started:", Sharpen.Extensions.CreateDate(job.GetStartTime())).("Finished:"
                                                                                                                                                                  , Sharpen.Extensions.CreateDate(job.GetFinishTime())).("Elapsed:", StringUtils.FormatTime
                                                                                                                                                                                                                             (Times.Elapsed(job.GetStartTime(), job.GetFinishTime(), false)));
            string amString = amInfos.Count == 1 ? "ApplicationMaster" : "ApplicationMasters";
            // todo - switch to use JobInfo
            IList <string> diagnostics = j.GetDiagnostics();

            if (diagnostics != null && !diagnostics.IsEmpty())
            {
                StringBuilder b = new StringBuilder();
                foreach (string diag in diagnostics)
                {
                    b.Append(diag);
                }
                infoBlock.("Diagnostics:", b.ToString());
            }
            if (job.GetNumMaps() > 0)
            {
                infoBlock.("Average Map Time", StringUtils.FormatTime(job.GetAvgMapTime()));
            }
            if (job.GetNumReduces() > 0)
            {
                infoBlock.("Average Shuffle Time", StringUtils.FormatTime(job.GetAvgShuffleTime()
                                                                          ));
                infoBlock.("Average Merge Time", StringUtils.FormatTime(job.GetAvgMergeTime()));
                infoBlock.("Average Reduce Time", StringUtils.FormatTime(job.GetAvgReduceTime()));
            }
            foreach (ConfEntryInfo entry in job.GetAcls())
            {
                infoBlock.("ACL " + entry.GetName() + ":", entry.GetValue());
            }
            Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> div = html.(typeof(InfoBlock
                                                                                        )).Div(JQueryUI.InfoWrap);
            // MRAppMasters Table
            Hamlet.TABLE <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > table = div
                                                                                             .Table("#job");
            table.Tr().Th(amString).().Tr().Th(JQueryUI.Th, "Attempt Number").Th(JQueryUI.Th,
                                                                                 "Start Time").Th(JQueryUI.Th, "Node").Th(JQueryUI.Th, "Logs").();
            bool odd = false;

            foreach (AMInfo amInfo in amInfos)
            {
                AMAttemptInfo attempt = new AMAttemptInfo(amInfo, job.GetId(), job.GetUserName(),
                                                          string.Empty, string.Empty);
                table.Tr((odd = !odd) ? JQueryUI.Odd : JQueryUI.Even).Td(attempt.GetAttemptId().ToString
                                                                             ()).Td(Sharpen.Extensions.CreateDate(attempt.GetStartTime()).ToString()).Td().A(
                    ".nodelink", Url(MRWebAppUtil.GetYARNWebappScheme(), attempt.GetNodeHttpAddress(
                                         )), attempt.GetNodeHttpAddress()).().Td().A(".logslink", Url(attempt.GetShortLogsLink
                                                                                                          ()), "logs").().();
            }
            table.();
            div.();
            html.Div(JQueryUI.InfoWrap).Table("#job").Tr().Th(JQueryUI.Th, "Task Type").Th(JQueryUI
                                                                                           .Th, "Total").Th(JQueryUI.Th, "Complete").().Tr(JQueryUI.Odd).Th().A(Url("tasks"
                                                                                                                                                                    , jid, "m"), "Map").().Td(job.GetMapsTotal().ToString().ToString()).Td(job.GetMapsCompleted
                                                                                                                                                                                                                                               ().ToString().ToString()).().Tr(JQueryUI.Even).Th().A(Url("tasks", jid, "r"), "Reduce"
                                                                                                                                                                                                                                                                                                     ).().Td(job.GetReducesTotal().ToString().ToString()).Td(job.GetReducesCompleted(
                                                                                                                                                                                                                                                                                                                                                                 ).ToString().ToString()).().().Table("#job").Tr().Th(JQueryUI.Th, "Attempt Type"
                                                                                                                                                                                                                                                                                                                                                                                                                      ).Th(JQueryUI.Th, "Failed").Th(JQueryUI.Th, "Killed").Th(JQueryUI.Th, "Successful"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ).().Tr(JQueryUI.Odd).Th("Maps").Td().A(Url("attempts", jid, "m", MRApps.TaskAttemptStateUI
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           .Failed.ToString()), job.GetFailedMapAttempts().ToString()).().Td().A(Url("attempts"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     , jid, "m", MRApps.TaskAttemptStateUI.Killed.ToString()), job.GetKilledMapAttempts
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ().ToString()).().Td().A(Url("attempts", jid, "m", MRApps.TaskAttemptStateUI.Successful
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  .ToString()), job.GetSuccessfulMapAttempts().ToString()).().().Tr(JQueryUI.Even)
            .Th("Reduces").Td().A(Url("attempts", jid, "r", MRApps.TaskAttemptStateUI.Failed
                                      .ToString()), job.GetFailedReduceAttempts().ToString()).().Td().A(Url("attempts"
                                                                                                            , jid, "r", MRApps.TaskAttemptStateUI.Killed.ToString()), job.GetKilledReduceAttempts
                                                                                                            ().ToString()).().Td().A(Url("attempts", jid, "r", MRApps.TaskAttemptStateUI.Successful
                                                                                                                                         .ToString()), job.GetSuccessfulReduceAttempts().ToString()).().().().();
        }
Example #12
0
        protected override void Render(HtmlBlock.Block html)
        {
            string containerid = $(YarnWebParams.ContainerId);

            if (containerid.IsEmpty())
            {
                Puts("Bad request: requires container ID");
                return;
            }
            ContainerId containerId = null;

            try
            {
                containerId = ConverterUtils.ToContainerId(containerid);
            }
            catch (ArgumentException)
            {
                Puts("Invalid container ID: " + containerid);
                return;
            }
            UserGroupInformation callerUGI       = GetCallerUGI();
            ContainerReport      containerReport = null;

            try
            {
                GetContainerReportRequest request = GetContainerReportRequest.NewInstance(containerId
                                                                                          );
                if (callerUGI == null)
                {
                    containerReport = appBaseProt.GetContainerReport(request).GetContainerReport();
                }
                else
                {
                    containerReport = callerUGI.DoAs(new _PrivilegedExceptionAction_78(this, request)
                                                     );
                }
            }
            catch (Exception e)
            {
                string message = "Failed to read the container " + containerid + ".";
                Log.Error(message, e);
                html.P().(message).();
                return;
            }
            if (containerReport == null)
            {
                Puts("Container not found: " + containerid);
                return;
            }
            ContainerInfo container = new ContainerInfo(containerReport);

            SetTitle(StringHelper.Join("Container ", containerid));
            Info("Container Overview").("Container State:", container.GetContainerState() ==
                                        null ? Unavailable : container.GetContainerState()).("Exit Status:", container.GetContainerExitStatus
                                                                                                 ()).("Node:", container.GetNodeHttpAddress() == null ? "#" : container.GetNodeHttpAddress
                                                                                                          (), container.GetNodeHttpAddress() == null ? "N/A" : container.GetNodeHttpAddress
                                                                                                          ()).("Priority:", container.GetPriority()).("Started:", Times.Format(container.GetStartedTime
                                                                                                                                                                                   ())).("Elapsed:", StringUtils.FormatTime(Times.Elapsed(container.GetStartedTime(
                                                                                                                                                                                                                                              ), container.GetFinishedTime()))).("Resource:", container.GetAllocatedMB() + " Memory, "
                                                                                                                                                                                                                                                                                 + container.GetAllocatedVCores() + " VCores").("Logs:", container.GetLogUrl() ==
                                                                                                                                                                                                                                                                                                                                null ? "#" : container.GetLogUrl(), container.GetLogUrl() == null ? "N/A" : "Logs"
                                                                                                                                                                                                                                                                                                                                ).("Diagnostics:", container.GetDiagnosticsInfo() == null ? string.Empty : container
                                                                                                                                                                                                                                                                                                                                   .GetDiagnosticsInfo());
            html.(typeof(InfoBlock));
        }