use of com.sequenceiq.cloudbreak.quartz.model.JobResource in project cloudbreak by hortonworks.
the class ExistingStackPatcherJobService method schedule.
public void schedule(Long stackId, StackPatchType stackPatchType) {
JobResource jobResource = stackService.getJobResource(stackId);
schedule(new ExistingStackPatcherJobAdapter(jobResource, stackPatchType));
}
use of com.sequenceiq.cloudbreak.quartz.model.JobResource in project cloudbreak by hortonworks.
the class DBStackJobInizializer method initJobs.
@Override
public void initJobs() {
Set<JobResource> dbStacks = checkedMeasure(() -> dbStackService.findAllForAutoSync(), LOGGER, ":::Auto sync::: db stacks are fetched from db in {}ms");
for (JobResource jobResource : dbStacks) {
dbStackJobService.schedule(jobResource);
}
LOGGER.info("Auto syncer is inited with {} db stacks on start", dbStacks.size());
}
use of com.sequenceiq.cloudbreak.quartz.model.JobResource in project cloudbreak by hortonworks.
the class StackJobInitializer method initJobs.
@Override
public void initJobs() {
List<JobResource> jobResources = checkedMeasure(() -> stackService.findAllForAutoSync(), LOGGER, ":::Auto sync::: Stacks are fetched from db in {}ms");
for (JobResource jobResource : jobResources) {
freeipaJobService.schedule(jobResource);
}
LOGGER.info("Auto syncer is inited with {} stacks on start", jobResources.size());
}
use of com.sequenceiq.cloudbreak.quartz.model.JobResource in project cloudbreak by hortonworks.
the class ExistingStackPatcherJobInitializer method initJobs.
@Override
public void initJobs() {
Set<StackPatchType> enabledStackPatchTypes = getEnabledStackPatchTypes();
LOGGER.info("Existing stack patch types enabled: {}", enabledStackPatchTypes);
List<JobResource> stacks = getAliveJobResources();
Set<Long> stackIds = stacks.stream().map(JobResource::getLocalId).map(Long::valueOf).collect(Collectors.toSet());
enabledStackPatchTypes.forEach(stackPatchType -> {
LOGGER.info("Scheduling stack patcher jobs for {}", stackPatchType);
Map<Long, List<StackPatch>> stackPatchesByStack = stackPatchService.findAllByTypeForStackIds(stackPatchType, stackIds).stream().collect(Collectors.groupingBy(StackPatch::getStackId));
for (JobResource stack : stacks) {
Long stackId = Long.valueOf(stack.getLocalId());
List<StackPatch> stackPatches = stackPatchesByStack.get(stackId);
boolean stackPatchIsFinalized = stackPatches != null && stackPatches.stream().anyMatch(stackPatch -> stackPatch.getStatus().isFinal());
if (!stackPatchIsFinalized) {
ExistingStackPatcherJobAdapter jobAdapter = new ExistingStackPatcherJobAdapter(stack, stackPatchType);
stackPatchService.getOrCreate(stackId, stackPatchType);
jobService.schedule(jobAdapter);
}
}
});
}
use of com.sequenceiq.cloudbreak.quartz.model.JobResource in project cloudbreak by hortonworks.
the class EnvironmentJobInitializer method initJobs.
@Override
public void initJobs() {
List<JobResource> jobResources = environmentService.findAllForAutoSync();
for (JobResource jobResource : jobResources) {
environmentJobService.schedule(jobResource);
}
LOGGER.info("Auto syncer is inited with {} environments on start", jobResources.size());
}
Aggregations