/// <exception cref="System.IO.IOException"/> public virtual GetCountersResponse GetCounters(GetCountersRequest request) { JobId jobId = request.GetJobId(); Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job job = this.VerifyAndGetJob(jobId, true ); GetCountersResponse response = this.recordFactory.NewRecordInstance <GetCountersResponse >(); response.SetCounters(TypeConverter.ToYarn(job.GetAllCounters())); return(response); }
private void GetCounters(AppContext ctx, Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job job) { if (job == null) { return; } total = job.GetAllCounters(); bool needTotalCounters = false; if (total == null) { total = new Counters(); needTotalCounters = true; } map = new Counters(); reduce = new Counters(); // Get all types of counters IDictionary <TaskId, Task> tasks = job.GetTasks(); foreach (Task t in tasks.Values) { Counters counters = t.GetCounters(); if (counters == null) { continue; } switch (t.GetType()) { case TaskType.Map: { map.IncrAllCounters(counters); break; } case TaskType.Reduce: { reduce.IncrAllCounters(counters); break; } } if (needTotalCounters) { total.IncrAllCounters(counters); } } }
public override Counters GetAllCounters() { return(job.GetAllCounters()); }
private void GetCounters(AppContext ctx) { JobId jobID = null; TaskId taskID = null; string tid = $(AMParams.TaskId); if (!tid.IsEmpty()) { taskID = MRApps.ToTaskID(tid); jobID = taskID.GetJobId(); } else { string jid = $(AMParams.JobId); if (jid != null && !jid.IsEmpty()) { jobID = MRApps.ToJobID(jid); } } if (jobID == null) { return; } job = ctx.GetJob(jobID); if (job == null) { return; } if (taskID != null) { task = job.GetTask(taskID); if (task == null) { return; } total = task.GetCounters(); return; } // Get all types of counters IDictionary <TaskId, Task> tasks = job.GetTasks(); total = job.GetAllCounters(); bool needTotalCounters = false; if (total == null) { total = new Counters(); needTotalCounters = true; } map = new Counters(); reduce = new Counters(); foreach (Task t in tasks.Values) { Counters counters = t.GetCounters(); if (counters == null) { continue; } switch (t.GetType()) { case TaskType.Map: { map.IncrAllCounters(counters); break; } case TaskType.Reduce: { reduce.IncrAllCounters(counters); break; } } if (needTotalCounters) { total.IncrAllCounters(counters); } } }
public virtual Counters GetAllCounters() { return(mockJob.GetAllCounters()); }