Search in sources :

Example 6 with JobIdentifier

use of com.thinkbiganalytics.scheduler.JobIdentifier in project kylo by Teradata.

the class DefaultServiceLevelAgreementScheduler method scheduleServiceLevelAgreement.

/**
 * Schedules an SLA to be run
 *
 * @param sla The SLA to schedule
 */
public void scheduleServiceLevelAgreement(ServiceLevelAgreement sla) {
    if (scheduledJobNames.containsKey(sla.getId())) {
        unscheduleServiceLevelAgreement(sla);
    }
    JobIdentifier jobIdentifier = slaJobName(sla);
    ServiceLevelAgreement.ID slaId = sla.getId();
    // schedule the job
    scheduleSlaJob(jobIdentifier, slaId);
    log.info("Schedule sla job " + jobIdentifier.getName());
    scheduledJobNames.put(sla.getId(), jobIdentifier.getName());
    // notify the other schedulers in the cluster of the scheduled job name
    if (clusterService.isClustered()) {
        clusterService.sendMessageToOthers(QTZ_JOB_SCHEDULED_MESSAGE_TYPE, new ScheduledServiceLevelAgreementClusterMessage(slaId, jobIdentifier));
    }
    if (!sla.isEnabled()) {
        disableServiceLevelAgreement(sla);
    }
}
Also used : ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) JcrServiceLevelAgreement(com.thinkbiganalytics.metadata.modeshape.sla.JcrServiceLevelAgreement) JobIdentifier(com.thinkbiganalytics.scheduler.JobIdentifier) DefaultJobIdentifier(com.thinkbiganalytics.scheduler.model.DefaultJobIdentifier)

Aggregations

JobIdentifier (com.thinkbiganalytics.scheduler.JobIdentifier)6 DefaultJobIdentifier (com.thinkbiganalytics.scheduler.model.DefaultJobIdentifier)6 QuartzScheduler (com.thinkbiganalytics.scheduler.QuartzScheduler)5 JcrServiceLevelAgreement (com.thinkbiganalytics.metadata.modeshape.sla.JcrServiceLevelAgreement)4 ServiceLevelAgreement (com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement)4 JobSchedulerException (com.thinkbiganalytics.scheduler.JobSchedulerException)3 TriggerIdentifier (com.thinkbiganalytics.scheduler.TriggerIdentifier)1 DefaultTriggerIdentifier (com.thinkbiganalytics.scheduler.model.DefaultTriggerIdentifier)1 ObjectAlreadyExistsException (org.quartz.ObjectAlreadyExistsException)1 SchedulerException (org.quartz.SchedulerException)1