Package org.apache.aurora.scheduler.base

Examples of org.apache.aurora.scheduler.base.ScheduleException


  public void testCreateJobFails() throws Exception {
    IJobConfiguration job = IJobConfiguration.build(makeJob());
    expectAuth(ROLE, true);
    lockManager.validateIfLocked(LOCK_KEY, Optional.of(LOCK));
    scheduler.createJob(SanitizedConfiguration.fromUnsanitized(job));
    expectLastCall().andThrow(new ScheduleException("fail"));
    control.replay();

    assertResponse(
        INVALID_REQUEST,
        thrift.createJob(job.newBuilder(), LOCK.newBuilder(), SESSION));
View Full Code Here


    String message = "Injected.";
    expectAuth(ROLE, true);
    lockManager.validateIfLocked(LOCK_KEY, Optional.<ILock>absent());
    scheduler.restartShards(JOB_KEY, shards, USER);
    expectLastCall().andThrow(new ScheduleException(message));

    control.replay();

    Response resp = thrift.restartShards(JOB_KEY.newBuilder(), shards, DEFAULT_LOCK, SESSION);
    assertResponse(INVALID_REQUEST, resp);
View Full Code Here

    lockManager.validateIfLocked(LOCK_KEY, Optional.of(LOCK));
    scheduler.addInstances(
        eq(JOB_KEY),
        eq(ImmutableSet.copyOf(config.getInstanceIds())),
        anyObject(ITaskConfig.class));
    expectLastCall().andThrow(new ScheduleException("Failed"));

    control.replay();

    assertResponse(INVALID_REQUEST, thrift.addInstances(config, LOCK.newBuilder(), SESSION));
  }
View Full Code Here

    storage.write(new MutateWork.NoResult<ScheduleException>() {
      @Override
      protected void execute(MutableStoreProvider storeProvider) throws ScheduleException {
        final IJobConfiguration job = sanitizedConfiguration.getJobConfig();
        if (hasActiveJob(job)) {
          throw new ScheduleException(
              "Job already exists: " + JobKeys.canonicalString(job.getKey()));
        }

        validateTaskLimits(job.getTaskConfig(), job.getInstanceCount());
        // TODO(mchucarroll): deprecate cron as a part of create/kill job.(AURORA-454)
        if (sanitizedConfiguration.isCron()) {
          try {
            LOG.warning("Deprecated behavior: scheduling job " + job.getKey()
                + " with cron via createJob (AURORA_454)");
            cronJobManager.createJob(SanitizedCronJob.from(sanitizedConfiguration));
          } catch (CronException e) {
            throw new ScheduleException(e);
          }
        } else {
          LOG.info("Launching " + sanitizedConfiguration.getTaskConfigs().size() + " tasks.");
          stateManager.insertPendingTasks(sanitizedConfiguration.getTaskConfigs());
        }
View Full Code Here

      throws ScheduleException {

    // TODO(maximk): This is a short-term hack to stop the bleeding from
    //               https://issues.apache.org/jira/browse/MESOS-691
    if (taskIdGenerator.generate(task, instances).length() > MAX_TASK_ID_LENGTH) {
      throw new ScheduleException(
          "Task ID is too long, please shorten your role or job name.");
    }

    if (instances > MAX_TASKS_PER_JOB.get()) {
      throw new ScheduleException("Job exceeds task limit of " + MAX_TASKS_PER_JOB.get());
    }

    QuotaCheckResult quotaCheck = quotaManager.checkQuota(task, instances);
    if (quotaCheck.getResult() == INSUFFICIENT_QUOTA) {
      throw new ScheduleException("Insufficient resource quota: " + quotaCheck.getDetails().or(""));
    }
  }
View Full Code Here

            storeProvider.getTaskStore().fetchTasks(Query.jobScoped(jobKey).active());

        Set<Integer> existingInstanceIds =
            FluentIterable.from(tasks).transform(Tasks.SCHEDULED_TO_INSTANCE_ID).toSet();
        if (!Sets.intersection(existingInstanceIds, instanceIds).isEmpty()) {
          throw new ScheduleException("Instance ID collision detected.");
        }

        stateManager.insertPendingTasks(Maps.asMap(instanceIds, Functions.constant(config)));
      }
    });
View Full Code Here

      IJobKey jobKey,
      final Set<Integer> shards,
      final String requestingUser) throws ScheduleException {

    if (!JobKeys.isValid(jobKey)) {
      throw new ScheduleException("Invalid job key: " + jobKey);
    }

    if (shards.isEmpty()) {
      throw new ScheduleException("At least one shard must be specified.");
    }

    final Query.Builder query = Query.instanceScoped(jobKey, shards).active();
    storage.write(new MutateWork.NoResult<ScheduleException>() {
      @Override
      protected void execute(MutableStoreProvider storeProvider) throws ScheduleException {
        Set<IScheduledTask> matchingTasks = storeProvider.getTaskStore().fetchTasks(query);
        if (matchingTasks.size() != shards.size()) {
          throw new ScheduleException("Not all requested shards are active.");
        }
        LOG.info("Restarting shards matching " + query);
        for (String taskId : Tasks.ids(matchingTasks)) {
          stateManager.changeState(
              taskId,
View Full Code Here

TOP

Related Classes of org.apache.aurora.scheduler.base.ScheduleException

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.