コード例 #1
0
ファイル: TypeConverter.cs プロジェクト: orf53975/hadoop.net
        public static JobStatus FromYarn(ApplicationReport application, string jobFile)
        {
            string trackingUrl = application.GetTrackingUrl();

            trackingUrl = trackingUrl == null ? string.Empty : trackingUrl;
            JobStatus jobStatus = new JobStatus(TypeConverter.FromYarn(application.GetApplicationId
                                                                           ()), 0.0f, 0.0f, 0.0f, 0.0f, TypeConverter.FromYarn(application.GetYarnApplicationState
                                                                                                                                   (), application.GetFinalApplicationStatus()), JobPriority.Normal, application.GetUser
                                                    (), application.GetName(), application.GetQueue(), jobFile, trackingUrl, false);

            jobStatus.SetSchedulingInfo(trackingUrl);
            // Set AM tracking url
            jobStatus.SetStartTime(application.GetStartTime());
            jobStatus.SetFinishTime(application.GetFinishTime());
            jobStatus.SetFailureInfo(application.GetDiagnostics());
            ApplicationResourceUsageReport resourceUsageReport = application.GetApplicationResourceUsageReport
                                                                     ();

            if (resourceUsageReport != null)
            {
                jobStatus.SetNeededMem(resourceUsageReport.GetNeededResources().GetMemory());
                jobStatus.SetNumReservedSlots(resourceUsageReport.GetNumReservedContainers());
                jobStatus.SetNumUsedSlots(resourceUsageReport.GetNumUsedContainers());
                jobStatus.SetReservedMem(resourceUsageReport.GetReservedResources().GetMemory());
                jobStatus.SetUsedMem(resourceUsageReport.GetUsedResources().GetMemory());
            }
            return(jobStatus);
        }
コード例 #2
0
ファイル: AppInfo.cs プロジェクト: orf53975/hadoop.net
 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());
     }
 }
コード例 #3
0
        /// <exception cref="System.IO.IOException"/>
        public virtual GetJobReportResponse GetJobReport(GetJobReportRequest request)
        {
            JobReport jobReport = recordFactory.NewRecordInstance <JobReport>();

            jobReport.SetJobId(request.GetJobId());
            jobReport.SetJobState(jobState);
            jobReport.SetUser(applicationReport.GetUser());
            jobReport.SetStartTime(applicationReport.GetStartTime());
            jobReport.SetDiagnostics(applicationReport.GetDiagnostics());
            jobReport.SetJobName(applicationReport.GetName());
            jobReport.SetTrackingUrl(applicationReport.GetTrackingUrl());
            jobReport.SetFinishTime(applicationReport.GetFinishTime());
            GetJobReportResponse resp = recordFactory.NewRecordInstance <GetJobReportResponse>
                                            ();

            resp.SetJobReport(jobReport);
            return(resp);
        }
コード例 #4
0
        /// <summary>Prints the application report for an application id.</summary>
        /// <param name="applicationId"/>
        /// <returns>exitCode</returns>
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        /// <exception cref="System.IO.IOException"/>
        private int PrintApplicationReport(string applicationId)
        {
            ApplicationReport appReport = null;

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

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