use of alluxio.job.wire.StatusSummary in project alluxio by Alluxio.
the class JobServiceMetricsCommand method run.
/**
* Runs a job services report metrics command.
*
* @return 0 on success, 1 otherwise
*/
public int run() throws IOException {
List<JobWorkerHealth> allWorkerHealth = mJobMasterClient.getAllWorkerHealth();
for (JobWorkerHealth workerHealth : allWorkerHealth) {
mPrintStream.print(String.format("Worker: %-10s ", workerHealth.getHostname()));
mPrintStream.print(String.format("Task Pool Size: %-7s", workerHealth.getTaskPoolSize()));
mPrintStream.print(String.format("Unfinished Tasks: %-7s", workerHealth.getUnfinishedTasks()));
mPrintStream.print(String.format("Active Tasks: %-7s", workerHealth.getNumActiveTasks()));
mPrintStream.println(String.format("Load Avg: %s", StringUtils.join(workerHealth.getLoadAverage(), ", ")));
}
mPrintStream.println();
JobServiceSummary jobServiceSummary = mJobMasterClient.getJobServiceSummary();
Collection<StatusSummary> jobStatusSummaries = jobServiceSummary.getSummaryPerStatus();
for (StatusSummary statusSummary : jobStatusSummaries) {
mPrintStream.print(String.format("Status: %-10s", statusSummary.getStatus()));
mPrintStream.println(String.format("Count: %s", statusSummary.getCount()));
}
mPrintStream.println();
mPrintStream.println(String.format("%s Most Recently Modified Jobs:", JobServiceSummary.RECENT_LENGTH));
List<JobInfo> lastActivities = jobServiceSummary.getRecentActivities();
printJobInfos(lastActivities);
mPrintStream.println(String.format("%s Most Recently Failed Jobs:", JobServiceSummary.RECENT_LENGTH));
List<JobInfo> lastFailures = jobServiceSummary.getRecentFailures();
printJobInfos(lastFailures);
mPrintStream.println(String.format("%s Longest Running Jobs:", JobServiceSummary.RECENT_LENGTH));
List<JobInfo> longestRunning = jobServiceSummary.getLongestRunning();
printJobInfos(longestRunning);
return 0;
}
Aggregations