Java Code Examples for org.apache.hadoop.mapreduce.v2.api.records.TaskReport#setCounters()
The following examples show how to use
org.apache.hadoop.mapreduce.v2.api.records.TaskReport#setCounters() .
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: MockJobs.java From hadoop with Apache License 2.0 | 5 votes |
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 2
Source File: NotRunningJob.java From hadoop with Apache License 2.0 | 5 votes |
@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 3
Source File: MockJobs.java From big-c with Apache License 2.0 | 5 votes |
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 4
Source File: NotRunningJob.java From big-c with Apache License 2.0 | 5 votes |
@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 5
Source File: NotRunningJob.java From incubator-tez with Apache License 2.0 | 5 votes |
@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 6
Source File: NotRunningJob.java From tez with Apache License 2.0 | 5 votes |
@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 7
Source File: TaskImpl.java From hadoop with Apache License 2.0 | 4 votes |
@Override public TaskReport getReport() { TaskReport report = recordFactory.newRecordInstance(TaskReport.class); readLock.lock(); try { TaskAttempt bestAttempt = selectBestAttempt(); report.setTaskId(taskId); report.setStartTime(getLaunchTime()); report.setFinishTime(getFinishTime()); report.setTaskState(getState()); report.setProgress(bestAttempt == null ? 0f : bestAttempt.getProgress()); report.setStatus(bestAttempt == null ? "" : bestAttempt.getReport().getStateString()); for (TaskAttempt attempt : attempts.values()) { if (TaskAttemptState.RUNNING.equals(attempt.getState())) { report.addRunningAttempt(attempt.getID()); } } report.setSuccessfulAttempt(successfulAttempt); for (TaskAttempt att : attempts.values()) { String prefix = "AttemptID:" + att.getID() + " Info:"; for (CharSequence cs : att.getDiagnostics()) { report.addDiagnostics(prefix + cs); } } // Add a copy of counters as the last step so that their lifetime on heap // is as small as possible. report.setCounters(TypeConverter.toYarn(bestAttempt == null ? TaskAttemptImpl.EMPTY_COUNTERS : bestAttempt.getCounters())); return report; } finally { readLock.unlock(); } }
Example 8
Source File: TaskImpl.java From big-c with Apache License 2.0 | 4 votes |
@Override public TaskReport getReport() { TaskReport report = recordFactory.newRecordInstance(TaskReport.class); readLock.lock(); try { TaskAttempt bestAttempt = selectBestAttempt(); report.setTaskId(taskId); report.setStartTime(getLaunchTime()); report.setFinishTime(getFinishTime()); report.setTaskState(getState()); report.setProgress(bestAttempt == null ? 0f : bestAttempt.getProgress()); report.setStatus(bestAttempt == null ? "" : bestAttempt.getReport().getStateString()); for (TaskAttempt attempt : attempts.values()) { if (TaskAttemptState.RUNNING.equals(attempt.getState())) { report.addRunningAttempt(attempt.getID()); } } report.setSuccessfulAttempt(successfulAttempt); for (TaskAttempt att : attempts.values()) { String prefix = "AttemptID:" + att.getID() + " Info:"; for (CharSequence cs : att.getDiagnostics()) { report.addDiagnostics(prefix + cs); } } // Add a copy of counters as the last step so that their lifetime on heap // is as small as possible. report.setCounters(TypeConverter.toYarn(bestAttempt == null ? TaskAttemptImpl.EMPTY_COUNTERS : bestAttempt.getCounters())); return report; } finally { readLock.unlock(); } }