Search in sources :

Example 1 with JobExecutionTypeStatistics

use of com.dangdang.ddframe.job.statistics.type.job.JobExecutionTypeStatistics in project elastic-job by dangdangdotcom.

the class StatisticManager method getJobExecutionTypeStatistics.

/**
     * 获取作业执行类型统计数据.
     * 
     * @return 作业执行类型统计数据对象
     */
public JobExecutionTypeStatistics getJobExecutionTypeStatistics() {
    int transientJobCnt = 0;
    int daemonJobCnt = 0;
    for (CloudJobConfiguration each : configurationService.loadAll()) {
        if (CloudJobExecutionType.TRANSIENT.equals(each.getJobExecutionType())) {
            transientJobCnt++;
        } else if (CloudJobExecutionType.DAEMON.equals(each.getJobExecutionType())) {
            daemonJobCnt++;
        }
    }
    return new JobExecutionTypeStatistics(transientJobCnt, daemonJobCnt);
}
Also used : JobExecutionTypeStatistics(com.dangdang.ddframe.job.statistics.type.job.JobExecutionTypeStatistics) CloudJobConfiguration(com.dangdang.ddframe.job.cloud.scheduler.config.job.CloudJobConfiguration)

Example 2 with JobExecutionTypeStatistics

use of com.dangdang.ddframe.job.statistics.type.job.JobExecutionTypeStatistics in project elastic-job by dangdangdotcom.

the class CloudJobRestfulApiTest method assertGetJobExecutionTypeStatistics.

@Test
public void assertGetJobExecutionTypeStatistics() throws Exception {
    String result = sentGetRequest("http://127.0.0.1:19000/job/statistics/jobs/executionType");
    JobExecutionTypeStatistics jobExecutionTypeStatistics = GsonFactory.getGson().fromJson(result, JobExecutionTypeStatistics.class);
    assertThat(jobExecutionTypeStatistics.getDaemonJobCount(), is(0));
    assertThat(jobExecutionTypeStatistics.getTransientJobCount(), is(0));
}
Also used : JobExecutionTypeStatistics(com.dangdang.ddframe.job.statistics.type.job.JobExecutionTypeStatistics) Test(org.junit.Test)

Aggregations

JobExecutionTypeStatistics (com.dangdang.ddframe.job.statistics.type.job.JobExecutionTypeStatistics)2 CloudJobConfiguration (com.dangdang.ddframe.job.cloud.scheduler.config.job.CloudJobConfiguration)1 Test (org.junit.Test)1