Search in sources :

Example 1 with StatusSummary

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;
}
Also used : StatusSummary(alluxio.job.wire.StatusSummary) JobInfo(alluxio.job.wire.JobInfo) JobWorkerHealth(alluxio.job.wire.JobWorkerHealth) JobServiceSummary(alluxio.job.wire.JobServiceSummary)

Aggregations

JobInfo (alluxio.job.wire.JobInfo)1 JobServiceSummary (alluxio.job.wire.JobServiceSummary)1 JobWorkerHealth (alluxio.job.wire.JobWorkerHealth)1 StatusSummary (alluxio.job.wire.StatusSummary)1