Search in sources :

Example 6 with CloudJobConfiguration

use of com.dangdang.ddframe.job.cloud.scheduler.config.job.CloudJobConfiguration 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 7 with CloudJobConfiguration

use of com.dangdang.ddframe.job.cloud.scheduler.config.job.CloudJobConfiguration in project elastic-job by dangdangdotcom.

the class JobContextTest method assertFrom.

@Test
public void assertFrom() {
    CloudJobConfiguration jobConfig = CloudJobConfigurationBuilder.createCloudJobConfiguration("test_job");
    JobContext actual = JobContext.from(jobConfig, ExecutionType.READY);
    assertThat(actual.getAssignedShardingItems().size(), is(10));
    for (int i = 0; i < actual.getAssignedShardingItems().size(); i++) {
        assertThat(actual.getAssignedShardingItems().get(i), is(i));
    }
}
Also used : CloudJobConfiguration(com.dangdang.ddframe.job.cloud.scheduler.config.job.CloudJobConfiguration) Test(org.junit.Test)

Aggregations

CloudJobConfiguration (com.dangdang.ddframe.job.cloud.scheduler.config.job.CloudJobConfiguration)7 CloudAppConfiguration (com.dangdang.ddframe.job.cloud.scheduler.config.app.CloudAppConfiguration)1 JobContext (com.dangdang.ddframe.job.cloud.scheduler.context.JobContext)1 TaskContext (com.dangdang.ddframe.job.context.TaskContext)1 ShardingContexts (com.dangdang.ddframe.job.executor.ShardingContexts)1 JobExecutionTypeStatistics (com.dangdang.ddframe.job.statistics.type.job.JobExecutionTypeStatistics)1 JobTypeStatistics (com.dangdang.ddframe.job.statistics.type.job.JobTypeStatistics)1 HashCode (com.google.common.hash.HashCode)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Protos (org.apache.mesos.Protos)1 Test (org.junit.Test)1