org.apache.hadoop.mapreduce.v2.api.records.TaskReport Java Examples

The following examples show how to use org.apache.hadoop.mapreduce.v2.api.records.TaskReport. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestHsWebServicesTasks.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public void verifyTaskGeneric(Task task, String id, String state,
    String type, String successfulAttempt, long startTime, long finishTime,
    long elapsedTime, float progress) {

  TaskId taskid = task.getID();
  String tid = MRApps.toString(taskid);
  TaskReport report = task.getReport();

  WebServicesTestUtils.checkStringMatch("id", tid, id);
  WebServicesTestUtils.checkStringMatch("type", task.getType().toString(),
      type);
  WebServicesTestUtils.checkStringMatch("state", report.getTaskState()
      .toString(), state);
  // not easily checked without duplicating logic, just make sure its here
  assertNotNull("successfulAttempt null", successfulAttempt);
  assertEquals("startTime wrong", report.getStartTime(), startTime);
  assertEquals("finishTime wrong", report.getFinishTime(), finishTime);
  assertEquals("elapsedTime wrong", finishTime - startTime, elapsedTime);
  assertEquals("progress wrong", report.getProgress() * 100, progress, 1e-3f);
}
 
Example #2
Source File: TestBlocks.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private Task getTask(long timestamp) {
  
  JobId jobId = new JobIdPBImpl();
  jobId.setId(0);
  jobId.setAppId(ApplicationIdPBImpl.newInstance(timestamp,1));

  TaskId taskId = new TaskIdPBImpl();
  taskId.setId(0);
  taskId.setTaskType(TaskType.REDUCE);
  taskId.setJobId(jobId);
  Task task = mock(Task.class);
  when(task.getID()).thenReturn(taskId);
  TaskReport report = mock(TaskReport.class);
  when(report.getProgress()).thenReturn(0.7f);
  when(report.getTaskState()).thenReturn(TaskState.SUCCEEDED);
  when(report.getStartTime()).thenReturn(100001L);
  when(report.getFinishTime()).thenReturn(100011L);

  when(task.getReport()).thenReturn(report);
  when(task.getType()).thenReturn(TaskType.REDUCE);
  return task;
}
 
Example #3
Source File: MRApp.java    From big-c with Apache License 2.0 6 votes vote down vote up
public void verifyCompleted() {
  for (Job job : getContext().getAllJobs().values()) {
    JobReport jobReport = job.getReport();
    System.out.println("Job start time :" + jobReport.getStartTime());
    System.out.println("Job finish time :" + jobReport.getFinishTime());
    Assert.assertTrue("Job start time is not less than finish time",
        jobReport.getStartTime() <= jobReport.getFinishTime());
    Assert.assertTrue("Job finish time is in future",
        jobReport.getFinishTime() <= System.currentTimeMillis());
    for (Task task : job.getTasks().values()) {
      TaskReport taskReport = task.getReport();
      System.out.println("Task start time : " + taskReport.getStartTime());
      System.out.println("Task finish time : " + taskReport.getFinishTime());
      Assert.assertTrue("Task start time is not less than finish time",
          taskReport.getStartTime() <= taskReport.getFinishTime());
      for (TaskAttempt attempt : task.getAttempts().values()) {
        TaskAttemptReport attemptReport = attempt.getReport();
        Assert.assertTrue("Attempt start time is not less than finish time",
            attemptReport.getStartTime() <= attemptReport.getFinishTime());
      }
    }
  }
}
 
Example #4
Source File: TestAMWebServicesTasks.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public void verifyTaskGeneric(Task task, String id, String state,
    String type, String successfulAttempt, long startTime, long finishTime,
    long elapsedTime, float progress, String status) {

  TaskId taskid = task.getID();
  String tid = MRApps.toString(taskid);
  TaskReport report = task.getReport();

  WebServicesTestUtils.checkStringMatch("id", tid, id);
  WebServicesTestUtils.checkStringMatch("type", task.getType().toString(),
      type);
  WebServicesTestUtils.checkStringMatch("state", report.getTaskState()
      .toString(), state);
  // not easily checked without duplicating logic, just make sure its here
  assertNotNull("successfulAttempt null", successfulAttempt);
  assertEquals("startTime wrong", report.getStartTime(), startTime);
  assertEquals("finishTime wrong", report.getFinishTime(), finishTime);
  assertEquals("elapsedTime wrong", finishTime - startTime, elapsedTime);
  assertEquals("progress wrong", report.getProgress() * 100, progress, 1e-3f);
  assertEquals("status wrong", report.getStatus(), status);
}
 
Example #5
Source File: TaskInfo.java    From big-c with Apache License 2.0 6 votes vote down vote up
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 = "";
  }
}
 
Example #6
Source File: MRApp.java    From big-c with Apache License 2.0 6 votes vote down vote up
public void waitForInternalState(TaskImpl task,
    TaskStateInternal finalState) throws Exception {
  int timeoutSecs = 0;
  TaskReport report = task.getReport();
  TaskStateInternal iState = task.getInternalState();
  while (!finalState.equals(iState) && timeoutSecs++ < 20) {
    System.out.println("Task Internal State is : " + iState
        + " Waiting for Internal state : " + finalState + "   progress : "
        + report.getProgress());
    Thread.sleep(500);
    report = task.getReport();
    iState = task.getInternalState();
  }
  System.out.println("Task Internal State is : " + iState);
  Assert.assertEquals("Task Internal state is not correct (timedout)",
      finalState, iState);
}
 
Example #7
Source File: CompletedTask.java    From big-c with Apache License 2.0 6 votes vote down vote up
private void constructTaskReport() {
  loadAllTaskAttempts();
  this.report = Records.newRecord(TaskReport.class);
  report.setTaskId(taskId);
  long minLaunchTime = Long.MAX_VALUE;
  for(TaskAttempt attempt: attempts.values()) {
    minLaunchTime = Math.min(minLaunchTime, attempt.getLaunchTime());
  }
  minLaunchTime = minLaunchTime == Long.MAX_VALUE ? -1 : minLaunchTime;
  report.setStartTime(minLaunchTime);
  report.setFinishTime(taskInfo.getFinishTime());
  report.setTaskState(getState());
  report.setProgress(getProgress());
  Counters counters = getCounters();
  if (counters == null) {
    counters = EMPTY_COUNTERS;
  }
  report.setCounters(TypeConverter.toYarn(counters));
  if (successfulAttempt != null) {
    report.setSuccessfulAttempt(successfulAttempt);
  }
  report.addAllDiagnostics(reportDiagnostics);
  report
      .addAllRunningAttempts(new ArrayList<TaskAttemptId>(attempts.keySet()));
}
 
Example #8
Source File: MRApp.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public void waitForInternalState(TaskImpl task,
    TaskStateInternal finalState) throws Exception {
  int timeoutSecs = 0;
  TaskReport report = task.getReport();
  TaskStateInternal iState = task.getInternalState();
  while (!finalState.equals(iState) && timeoutSecs++ < 20) {
    System.out.println("Task Internal State is : " + iState
        + " Waiting for Internal state : " + finalState + "   progress : "
        + report.getProgress());
    Thread.sleep(500);
    report = task.getReport();
    iState = task.getInternalState();
  }
  System.out.println("Task Internal State is : " + iState);
  Assert.assertEquals("Task Internal state is not correct (timedout)",
      finalState, iState);
}
 
Example #9
Source File: TestBlocks.java    From big-c with Apache License 2.0 6 votes vote down vote up
private Task getTask(long timestamp) {
  
  JobId jobId = new JobIdPBImpl();
  jobId.setId(0);
  jobId.setAppId(ApplicationIdPBImpl.newInstance(timestamp,1));

  TaskId taskId = new TaskIdPBImpl();
  taskId.setId(0);
  taskId.setTaskType(TaskType.REDUCE);
  taskId.setJobId(jobId);
  Task task = mock(Task.class);
  when(task.getID()).thenReturn(taskId);
  TaskReport report = mock(TaskReport.class);
  when(report.getProgress()).thenReturn(0.7f);
  when(report.getTaskState()).thenReturn(TaskState.SUCCEEDED);
  when(report.getStartTime()).thenReturn(100001L);
  when(report.getFinishTime()).thenReturn(100011L);

  when(task.getReport()).thenReturn(report);
  when(task.getType()).thenReturn(TaskType.REDUCE);
  return task;
}
 
Example #10
Source File: MRApp.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public void verifyCompleted() {
  for (Job job : getContext().getAllJobs().values()) {
    JobReport jobReport = job.getReport();
    System.out.println("Job start time :" + jobReport.getStartTime());
    System.out.println("Job finish time :" + jobReport.getFinishTime());
    Assert.assertTrue("Job start time is not less than finish time",
        jobReport.getStartTime() <= jobReport.getFinishTime());
    Assert.assertTrue("Job finish time is in future",
        jobReport.getFinishTime() <= System.currentTimeMillis());
    for (Task task : job.getTasks().values()) {
      TaskReport taskReport = task.getReport();
      System.out.println("Task start time : " + taskReport.getStartTime());
      System.out.println("Task finish time : " + taskReport.getFinishTime());
      Assert.assertTrue("Task start time is not less than finish time",
          taskReport.getStartTime() <= taskReport.getFinishTime());
      for (TaskAttempt attempt : task.getAttempts().values()) {
        TaskAttemptReport attemptReport = attempt.getReport();
        Assert.assertTrue("Attempt start time is not less than finish time",
            attemptReport.getStartTime() <= attemptReport.getFinishTime());
      }
    }
  }
}
 
Example #11
Source File: TestHsWebServicesTasks.java    From big-c with Apache License 2.0 6 votes vote down vote up
public void verifyTaskGeneric(Task task, String id, String state,
    String type, String successfulAttempt, long startTime, long finishTime,
    long elapsedTime, float progress) {

  TaskId taskid = task.getID();
  String tid = MRApps.toString(taskid);
  TaskReport report = task.getReport();

  WebServicesTestUtils.checkStringMatch("id", tid, id);
  WebServicesTestUtils.checkStringMatch("type", task.getType().toString(),
      type);
  WebServicesTestUtils.checkStringMatch("state", report.getTaskState()
      .toString(), state);
  // not easily checked without duplicating logic, just make sure its here
  assertNotNull("successfulAttempt null", successfulAttempt);
  assertEquals("startTime wrong", report.getStartTime(), startTime);
  assertEquals("finishTime wrong", report.getFinishTime(), finishTime);
  assertEquals("elapsedTime wrong", finishTime - startTime, elapsedTime);
  assertEquals("progress wrong", report.getProgress() * 100, progress, 1e-3f);
}
 
Example #12
Source File: TestAMWebServicesTasks.java    From big-c with Apache License 2.0 6 votes vote down vote up
public void verifyTaskGeneric(Task task, String id, String state,
    String type, String successfulAttempt, long startTime, long finishTime,
    long elapsedTime, float progress, String status) {

  TaskId taskid = task.getID();
  String tid = MRApps.toString(taskid);
  TaskReport report = task.getReport();

  WebServicesTestUtils.checkStringMatch("id", tid, id);
  WebServicesTestUtils.checkStringMatch("type", task.getType().toString(),
      type);
  WebServicesTestUtils.checkStringMatch("state", report.getTaskState()
      .toString(), state);
  // not easily checked without duplicating logic, just make sure its here
  assertNotNull("successfulAttempt null", successfulAttempt);
  assertEquals("startTime wrong", report.getStartTime(), startTime);
  assertEquals("finishTime wrong", report.getFinishTime(), finishTime);
  assertEquals("elapsedTime wrong", finishTime - startTime, elapsedTime);
  assertEquals("progress wrong", report.getProgress() * 100, progress, 1e-3f);
  assertEquals("status wrong", report.getStatus(), status);
}
 
Example #13
Source File: MRCommunicator.java    From jumbune with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * This method tries to extract all Map OR Reduce attempt Task Reports for a given Job Id
 * @param taskType, TaskType {MAP|REDUCE}
 * @param jobId, the Job Id for which all Task Reports requires to be extracted
 * @return, Map<TaskId, TaskReport>
 * @throws IOException
 */
public Map<TaskId, TaskReport> getTaskTypeWiseTaskReports(TaskType taskType, JobId jobId) throws IOException{
	Map<TaskId, TaskReport> reports = new HashMap<TaskId, TaskReport>();
	TaskReport report;

	//Attempting to extract Task Type wise Attempt Reports
	boolean rme = false;
	int id = 0;
	do{
		try{
			report = getTaskReport(jobId, id, taskType);
			TaskId taskId = MRBuilderUtils.newTaskId(jobId, id, taskType);
			reports.put(taskId, report);
			id++;
		}catch(RemoteException re){
			rme = true;
		}
	}while(!rme);

	return reports;
}
 
Example #14
Source File: TaskInfo.java    From hadoop with Apache License 2.0 6 votes vote down vote up
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 = "";
  }
}
 
Example #15
Source File: CompletedTask.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private void constructTaskReport() {
  loadAllTaskAttempts();
  this.report = Records.newRecord(TaskReport.class);
  report.setTaskId(taskId);
  long minLaunchTime = Long.MAX_VALUE;
  for(TaskAttempt attempt: attempts.values()) {
    minLaunchTime = Math.min(minLaunchTime, attempt.getLaunchTime());
  }
  minLaunchTime = minLaunchTime == Long.MAX_VALUE ? -1 : minLaunchTime;
  report.setStartTime(minLaunchTime);
  report.setFinishTime(taskInfo.getFinishTime());
  report.setTaskState(getState());
  report.setProgress(getProgress());
  Counters counters = getCounters();
  if (counters == null) {
    counters = EMPTY_COUNTERS;
  }
  report.setCounters(TypeConverter.toYarn(counters));
  if (successfulAttempt != null) {
    report.setSuccessfulAttempt(successfulAttempt);
  }
  report.addAllDiagnostics(reportDiagnostics);
  report
      .addAllRunningAttempts(new ArrayList<TaskAttemptId>(attempts.keySet()));
}
 
Example #16
Source File: CompletedTask.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized TaskReport getReport() {
  if (report == null) {
    constructTaskReport();
  }
  return report;
}
 
Example #17
Source File: GetTaskReportsResponsePBImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
private void addTaskReportsToProto() {
  maybeInitBuilder();
  builder.clearTaskReports();
  if (taskReports == null)
    return;
  Iterable<TaskReportProto> iterable = new Iterable<TaskReportProto>() {
    @Override
    public Iterator<TaskReportProto> iterator() {
      return new Iterator<TaskReportProto>() {

        Iterator<TaskReport> iter = taskReports.iterator();

        @Override
        public boolean hasNext() {
          return iter.hasNext();
        }

        @Override
        public TaskReportProto next() {
          return convertToProtoFormat(iter.next());
        }

        @Override
        public void remove() {
          throw new UnsupportedOperationException();

        }
      };

    }
  };
  builder.addAllTaskReports(iterable);
}
 
Example #18
Source File: GetTaskReportResponsePBImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void setTaskReport(TaskReport taskReport) {
  maybeInitBuilder();
  if (taskReport == null) 
    builder.clearTaskReport();
  this.taskReport = taskReport;
}
 
Example #19
Source File: NotRunningJob.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public GetTaskReportsResponse getTaskReports(GetTaskReportsRequest request)
    throws IOException {
  GetTaskReportsResponse resp =
    recordFactory.newRecordInstance(GetTaskReportsResponse.class);
  resp.addAllTaskReports(new ArrayList<TaskReport>());
  return resp;
}
 
Example #20
Source File: MRApp.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public void waitForState(Task task, TaskState finalState) throws Exception {
  int timeoutSecs = 0;
  TaskReport report = task.getReport();
  while (!finalState.equals(report.getTaskState()) &&
      timeoutSecs++ < 20) {
    System.out.println("Task State for " + task.getID() + " is : "
        + report.getTaskState() + " Waiting for state : " + finalState
        + "   progress : " + report.getProgress());
    report = task.getReport();
    Thread.sleep(500);
  }
  System.out.println("Task State is : " + report.getTaskState());
  Assert.assertEquals("Task state is not correct (timedout)", finalState, 
      report.getTaskState());
}
 
Example #21
Source File: NotRunningJob.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public GetTaskReportResponse getTaskReport(GetTaskReportRequest request)
    throws IOException {
  GetTaskReportResponse resp =
    recordFactory.newRecordInstance(GetTaskReportResponse.class);
  TaskReport report = recordFactory.newRecordInstance(TaskReport.class);
  report.setTaskId(request.getTaskId());
  report.setTaskState(TaskState.NEW);
  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.addAllCounterGroups(new HashMap<String, CounterGroup>());
  report.setCounters(counters);
  report.addAllRunningAttempts(new ArrayList<TaskAttemptId>());
  return resp;
}
 
Example #22
Source File: MRCommunicator.java    From jumbune with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * This method prepares a Map containing Node Manager details (hostname, port) on which successful attempts of the job ran
 * @param jobId
 * @return Map<String, Integer> containing hostname and rpc port of Node Managers
 * @throws IOException
 */
public Map<String, Integer> getAttemptedNodes(JobId jobId) throws IOException{
	Map<String, Integer> nodes = new HashMap<String, Integer>();
	Map<TaskId, TaskReport> reports = getAllTaskReports(jobId);
	for(Map.Entry<TaskId, TaskReport> report: reports.entrySet()){
		TaskId taskId = report.getKey();
		TaskReport taskReport = report.getValue();
		TaskAttemptId attemptId = taskReport.getSuccessfulAttempt();
		TaskAttemptReport taskAttemptReport = getTaskAttemptReport(taskId, attemptId.getId());
		nodes.put(taskAttemptReport.getNodeManagerHost(), taskAttemptReport.getNodeManagerPort());
	}
	return nodes;
}
 
Example #23
Source File: TestJobHistoryEntities.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test (timeout=10000)
public void testCompletedTask() throws Exception {
  HistoryFileInfo info = mock(HistoryFileInfo.class);
  when(info.getConfFile()).thenReturn(fullConfPath);
  completedJob =
    new CompletedJob(conf, jobId, fullHistoryPath, loadTasks, "user",
        info, jobAclsManager);
  TaskId mt1Id = MRBuilderUtils.newTaskId(jobId, 0, TaskType.MAP);
  TaskId rt1Id = MRBuilderUtils.newTaskId(jobId, 0, TaskType.REDUCE);
  
  Map<TaskId, Task> mapTasks = completedJob.getTasks(TaskType.MAP);
  Map<TaskId, Task> reduceTasks = completedJob.getTasks(TaskType.REDUCE);
  assertEquals(10, mapTasks.size());
  assertEquals(2, reduceTasks.size());
  
  Task mt1 = mapTasks.get(mt1Id);
  assertEquals(1, mt1.getAttempts().size());
  assertEquals(TaskState.SUCCEEDED, mt1.getState());
  TaskReport mt1Report = mt1.getReport();
  assertEquals(TaskState.SUCCEEDED, mt1Report.getTaskState());
  assertEquals(mt1Id, mt1Report.getTaskId());
  Task rt1 = reduceTasks.get(rt1Id);
  assertEquals(1, rt1.getAttempts().size());
  assertEquals(TaskState.SUCCEEDED, rt1.getState());
  TaskReport rt1Report = rt1.getReport();
  assertEquals(TaskState.SUCCEEDED, rt1Report.getTaskState());
  assertEquals(rt1Id, rt1Report.getTaskId());
}
 
Example #24
Source File: NotRunningJob.java    From tez with Apache License 2.0 5 votes vote down vote up
@Override
public GetTaskReportsResponse getTaskReports(GetTaskReportsRequest request)
    throws IOException {
  GetTaskReportsResponse resp =
    recordFactory.newRecordInstance(GetTaskReportsResponse.class);
  resp.addAllTaskReports(new ArrayList<TaskReport>());
  return resp;
}
 
Example #25
Source File: GetTaskReportsResponsePBImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public void addAllTaskReports(final List<TaskReport> taskReports) {
  if (taskReports == null)
    return;
  initTaskReports();
  this.taskReports.addAll(taskReports);
}
 
Example #26
Source File: MockJobs.java    From big-c with Apache License 2.0 5 votes vote down vote up
public static TaskReport newTaskReport(TaskId id) {
  TaskReport report = Records.newRecord(TaskReport.class);
  report.setTaskId(id);
  report
      .setStartTime(System.currentTimeMillis() - (int) (Math.random() * DT));
  report.setFinishTime(System.currentTimeMillis()
      + (int) (Math.random() * DT) + 1);
  report.setProgress((float) Math.random());
  report.setStatus("Moving average: " + Math.random());
  report.setCounters(TypeConverter.toYarn(newCounters()));
  report.setTaskState(TASK_STATES.next());
  return report;
}
 
Example #27
Source File: GetTaskReportsResponsePBImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
private void initTaskReports() {
  if (this.taskReports != null) {
    return;
  }
  GetTaskReportsResponseProtoOrBuilder p = viaProto ? proto : builder;
  List<TaskReportProto> list = p.getTaskReportsList();
  this.taskReports = new ArrayList<TaskReport>();

  for (TaskReportProto c : list) {
    this.taskReports.add(convertFromProtoFormat(c));
  }
}
 
Example #28
Source File: MRApp.java    From big-c with Apache License 2.0 5 votes vote down vote up
public void waitForState(Task task, TaskState finalState) throws Exception {
  int timeoutSecs = 0;
  TaskReport report = task.getReport();
  while (!finalState.equals(report.getTaskState()) &&
      timeoutSecs++ < 20) {
    System.out.println("Task State for " + task.getID() + " is : "
        + report.getTaskState() + " Waiting for state : " + finalState
        + "   progress : " + report.getProgress());
    report = task.getReport();
    Thread.sleep(500);
  }
  System.out.println("Task State is : " + report.getTaskState());
  Assert.assertEquals("Task state is not correct (timedout)", finalState, 
      report.getTaskState());
}
 
Example #29
Source File: NotRunningJob.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public GetTaskReportResponse getTaskReport(GetTaskReportRequest request)
    throws IOException {
  GetTaskReportResponse resp =
    recordFactory.newRecordInstance(GetTaskReportResponse.class);
  TaskReport report = recordFactory.newRecordInstance(TaskReport.class);
  report.setTaskId(request.getTaskId());
  report.setTaskState(TaskState.NEW);
  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.addAllCounterGroups(new HashMap<String, CounterGroup>());
  report.setCounters(counters);
  report.addAllRunningAttempts(new ArrayList<TaskAttemptId>());
  return resp;
}
 
Example #30
Source File: NotRunningJob.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public GetTaskReportsResponse getTaskReports(GetTaskReportsRequest request)
    throws IOException {
  GetTaskReportsResponse resp =
    recordFactory.newRecordInstance(GetTaskReportsResponse.class);
  resp.addAllTaskReports(new ArrayList<TaskReport>());
  return resp;
}