Search in sources :

Example 6 with JobResource

use of com.sequenceiq.cloudbreak.quartz.model.JobResource in project cloudbreak by hortonworks.

the class DBStackJobInizializerTest method shouldDeleteAllJobsAndScheduleNewOnesForDbStacks.

@Test
public void shouldDeleteAllJobsAndScheduleNewOnesForDbStacks() {
    JobResource jobResource = mock(JobResource.class);
    Set<JobResource> jobResources = Set.of(jobResource);
    when(dbStackService.findAllForAutoSync()).thenReturn(jobResources);
    victim.initJobs();
    verify(dbStackJobService).schedule(jobResource);
}
Also used : JobResource(com.sequenceiq.cloudbreak.quartz.model.JobResource) Test(org.junit.jupiter.api.Test)

Example 7 with JobResource

use of com.sequenceiq.cloudbreak.quartz.model.JobResource in project cloudbreak by hortonworks.

the class NodeStatusJobInitializer method initJobs.

@Override
public void initJobs() {
    if (nodeStatusJobConfig.isEnabled()) {
        List<JobResource> jobResources = checkedMeasure(() -> stackService.findAllForAutoSync(), LOGGER, ":::Node status check::: Stacks are fetched from db in {}ms");
        for (JobResource jobResource : jobResources) {
            nodeStatusJobService.schedule(new NodeStatusJobAdapter(jobResource));
        }
        LOGGER.info("Node status checks are inited with {} stacks on start", jobResources.size());
    } else {
        LOGGER.info("Skipping scheduling node status checker jobs, as they are disabled");
    }
}
Also used : JobResource(com.sequenceiq.cloudbreak.quartz.model.JobResource)

Aggregations

JobResource (com.sequenceiq.cloudbreak.quartz.model.JobResource)7 StackPatch (com.sequenceiq.cloudbreak.domain.stack.StackPatch)1 StackPatchType (com.sequenceiq.cloudbreak.domain.stack.StackPatchType)1 AbstractStackJobInitializer (com.sequenceiq.cloudbreak.job.AbstractStackJobInitializer)1 ExistingStackPatcherConfig (com.sequenceiq.cloudbreak.job.stackpatcher.config.ExistingStackPatcherConfig)1 StackPatchService (com.sequenceiq.cloudbreak.service.stackpatch.StackPatchService)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Inject (javax.inject.Inject)1 Test (org.junit.jupiter.api.Test)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1 Component (org.springframework.stereotype.Component)1