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 ())); } } } }
public static JobStatus FromYarn(JobReport jobreport, string trackingUrl) { JobPriority jobPriority = JobPriority.Normal; JobStatus jobStatus = new JobStatus(FromYarn(jobreport.GetJobId()), jobreport.GetSetupProgress (), jobreport.GetMapProgress(), jobreport.GetReduceProgress(), jobreport.GetCleanupProgress (), FromYarn(jobreport.GetJobState()), jobPriority, jobreport.GetUser(), jobreport .GetJobName(), jobreport.GetJobFile(), trackingUrl, jobreport.IsUber()); jobStatus.SetStartTime(jobreport.GetStartTime()); jobStatus.SetFinishTime(jobreport.GetFinishTime()); jobStatus.SetFailureInfo(jobreport.GetDiagnostics()); return(jobStatus); }
/// <exception cref="System.Exception"/> public virtual void WaitForState(Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job job, JobState finalState) { int timeoutSecs = 0; JobReport report = job.GetReport(); while (!finalState.Equals(report.GetJobState()) && timeoutSecs++ < 20) { System.Console.Out.WriteLine("Job State is : " + report.GetJobState() + " Waiting for state : " + finalState + " map progress : " + report.GetMapProgress() + " reduce progress : " + report.GetReduceProgress()); report = job.GetReport(); Sharpen.Thread.Sleep(500); } System.Console.Out.WriteLine("Job State is : " + report.GetJobState()); NUnit.Framework.Assert.AreEqual("Job state is not correct (timedout)", finalState , job.GetState()); }