Example #1
0
        public virtual void TestFromYarn()
        {
            int appStartTime                       = 612354;
            int appFinishTime                      = 612355;
            YarnApplicationState state             = YarnApplicationState.Running;
            ApplicationId        applicationId     = ApplicationId.NewInstance(0, 0);
            ApplicationReport    applicationReport = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord
                                                     <ApplicationReport>();

            applicationReport.SetApplicationId(applicationId);
            applicationReport.SetYarnApplicationState(state);
            applicationReport.SetStartTime(appStartTime);
            applicationReport.SetFinishTime(appFinishTime);
            applicationReport.SetUser("TestTypeConverter-user");
            ApplicationResourceUsageReport appUsageRpt = Org.Apache.Hadoop.Yarn.Util.Records.
                                                         NewRecord <ApplicationResourceUsageReport>();
            Resource r = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <Resource>();

            r.SetMemory(2048);
            appUsageRpt.SetNeededResources(r);
            appUsageRpt.SetNumReservedContainers(1);
            appUsageRpt.SetNumUsedContainers(3);
            appUsageRpt.SetReservedResources(r);
            appUsageRpt.SetUsedResources(r);
            applicationReport.SetApplicationResourceUsageReport(appUsageRpt);
            JobStatus jobStatus = TypeConverter.FromYarn(applicationReport, "dummy-jobfile");

            NUnit.Framework.Assert.AreEqual(appStartTime, jobStatus.GetStartTime());
            NUnit.Framework.Assert.AreEqual(appFinishTime, jobStatus.GetFinishTime());
            NUnit.Framework.Assert.AreEqual(state.ToString(), jobStatus.GetState().ToString()
                                            );
        }
Example #2
0
 public static Org.Apache.Hadoop.Mapred.JobStatus Downgrade(Org.Apache.Hadoop.Mapreduce.JobStatus
                                                            stat)
 {
     Org.Apache.Hadoop.Mapred.JobStatus old = new Org.Apache.Hadoop.Mapred.JobStatus(JobID
                                                                                     .Downgrade(stat.GetJobID()), stat.GetSetupProgress(), stat.GetMapProgress(), stat
                                                                                     .GetReduceProgress(), stat.GetCleanupProgress(), stat.GetState().GetValue(), JobPriority
                                                                                     .ValueOf(stat.GetPriority().ToString()), stat.GetUsername(), stat.GetJobName(),
                                                                                     stat.GetQueue(), stat.GetJobFile(), stat.GetTrackingUrl(), stat.IsUber());
     old.SetStartTime(stat.GetStartTime());
     old.SetFinishTime(stat.GetFinishTime());
     old.SetSchedulingInfo(stat.GetSchedulingInfo());
     old.SetHistoryFile(stat.GetHistoryFile());
     return(old);
 }
Example #3
0
        public virtual void TestFromYarnJobReport()
        {
            int           jobStartTime  = 612354;
            int           jobFinishTime = 612355;
            JobState      state         = JobState.Running;
            JobId         jobId         = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <JobId>();
            JobReport     jobReport     = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <JobReport>();
            ApplicationId applicationId = ApplicationId.NewInstance(0, 0);

            jobId.SetAppId(applicationId);
            jobId.SetId(0);
            jobReport.SetJobId(jobId);
            jobReport.SetJobState(state);
            jobReport.SetStartTime(jobStartTime);
            jobReport.SetFinishTime(jobFinishTime);
            jobReport.SetUser("TestTypeConverter-user");
            JobStatus jobStatus = TypeConverter.FromYarn(jobReport, "dummy-jobfile");

            NUnit.Framework.Assert.AreEqual(jobStartTime, jobStatus.GetStartTime());
            NUnit.Framework.Assert.AreEqual(jobFinishTime, jobStatus.GetFinishTime());
            NUnit.Framework.Assert.AreEqual(state.ToString(), jobStatus.GetState().ToString()
                                            );
        }