Package org.apache.aurora.scheduler.cron

Examples of org.apache.aurora.scheduler.cron.CronException


  private void triggerJob(IJobKey jobKey) throws CronException {
    try {
      scheduler.triggerJob(Quartz.jobKey(jobKey));
    } catch (SchedulerException e) {
      throw new CronException(e);
    }
    LOG.info(String.format("Triggered cron job for %s.", JobKeys.canonicalString(jobKey)));
  }
View Full Code Here


  private static void checkNoRunOverlap(SanitizedCronJob cronJob) throws CronException {
    // NOTE: We check at create and update instead of in SanitizedCronJob to allow existing jobs
    // but reject new ones.
    if (CronCollisionPolicy.RUN_OVERLAP.equals(cronJob.getCronCollisionPolicy())) {
      throw new CronException(
          "The RUN_OVERLAP collision policy has been removed (AURORA-38).");
    }
  }
View Full Code Here

    });
  }

  private void checkNotExists(IJobKey jobKey, JobStore jobStore) throws CronException {
    if (jobStore.fetchJob(getManagerKey(), jobKey).isPresent()) {
      throw new CronException(
          String.format("Job already exists for %s.", JobKeys.canonicalString(jobKey)));
    }
  }
View Full Code Here

    }
  }

  private void checkCronExists(IJobKey jobKey, JobStore jobStore) throws CronException {
    if (!jobStore.fetchJob(getManagerKey(), jobKey).isPresent()) {
      throw new CronException(
          String.format("No cron template found for %s.", JobKeys.canonicalString(jobKey)));
    }
  }
View Full Code Here

    try {
      scheduler.scheduleJob(
          Quartz.jobDetail(jobKey, AuroraCronJob.class),
          Quartz.cronTrigger(crontabEntry, timeZone));
    } catch (SchedulerException e) {
      throw new CronException(e);
    }
    LOG.info(String.format(
        "Scheduled job %s with schedule %s.", JobKeys.canonicalString(jobKey), crontabEntry));
  }
View Full Code Here

  @Test
  public void testReplaceCronTemplateDoesNotExist() throws Exception {
    expectAuth(ROLE, true);
    lockManager.validateIfLocked(LOCK_KEY, Optional.<ILock>absent());
    cronJobManager.updateJob(anyObject(SanitizedCronJob.class));
    expectLastCall().andThrow(new CronException("Nope"));

    control.replay();

    assertResponse(INVALID_REQUEST, thrift.replaceCronTemplate(CRON_JOB, DEFAULT_LOCK, SESSION));
  }
View Full Code Here

  @Test
  public void testReplaceCronTemplateDoesNotExist() throws Exception {
    expectAuth(ROLE, true);
    lockManager.validateIfLocked(LOCK_KEY, Optional.<ILock>absent());
    cronJobManager.updateJob(anyObject(SanitizedCronJob.class));
    expectLastCall().andThrow(new CronException("Nope"));

    control.replay();

    assertResponse(INVALID_REQUEST, thrift.replaceCronTemplate(CRON_JOB, DEFAULT_LOCK, SESSION));
  }
View Full Code Here

  @Test
  public void testStartCronJobFailsInCronManager() throws Exception {
    expectAuth(ROLE, true);
    cronJobManager.startJobNow(JOB_KEY);
    expectLastCall().andThrow(new CronException("failed"));
    control.replay();
    assertResponse(INVALID_REQUEST, thrift.startCronJob(JOB_KEY.newBuilder(), SESSION));
  }
View Full Code Here

TOP

Related Classes of org.apache.aurora.scheduler.cron.CronException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.