Examples of IJobKey


Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

      protected void execute(MutableStoreProvider storeProvider)
          throws UpdateStateException {

        IJobUpdateSummary summary = update.getSummary();
        IJobUpdateInstructions instructions = update.getInstructions();
        IJobKey job = summary.getJobKey();

        // Validate the update configuration by making sure we can create an updater for it.
        updateFactory.newUpdate(update.getInstructions(), true);

        if (instructions.getInitialState().isEmpty() && !instructions.isSetDesiredState()) {
          throw new IllegalArgumentException("Update instruction is a no-op.");
        }

        LOG.info("Starting update for job " + job);
        ILock lock;
        try {
          lock =
              lockManager.acquireLock(ILockKey.build(LockKey.job(job.newBuilder())), updatingUser);
        } catch (LockException e) {
          throw new UpdateStateException(e.getMessage(), e);
        }

        storeProvider.getJobUpdateStore().saveJobUpdate(
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

  private void instanceChanged(final IInstanceKey instance, final Optional<IScheduledTask> state) {
    storage.write(new MutateWork.NoResult.Quiet() {
      @Override
      protected void execute(MutableStoreProvider storeProvider) {
        IJobKey job = instance.getJobKey();
        UpdateFactory.Update update = updates.get(job);
        if (update != null) {
          if (update.getUpdater().containsInstance(instance.getInstanceId())) {
            LOG.info("Forwarding task change for " + InstanceKeys.toString(instance));
            evaluateUpdater(
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

      final UpdateFactory.Update update,
      IJobUpdateSummary summary,
      Map<Integer, Optional<IScheduledTask>> changedInstance) {

    JobUpdateStatus updaterStatus = summary.getState().getStatus();
    final IJobKey job = summary.getJobKey();

    final JobUpdateStore.Mutable updateStore = storeProvider.getJobUpdateStore();
    if (!updateStore.getLockToken(summary.getUpdateId()).isPresent()) {
      recordAndChangeJobUpdateStatus(
          storeProvider,
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

      JobConfiguration mutableJob,
      @Nullable Lock mutableLock,
      SessionKey session) {

    IJobConfiguration job = IJobConfiguration.build(mutableJob);
    IJobKey jobKey = JobKeys.assertValid(job.getKey());
    requireNonNull(session);

    try {
      sessionValidator.checkAuthenticated(session, ImmutableSet.of(jobKey.getRole()));
    } catch (AuthFailedException e) {
      return errorResponse(AUTH_FAILED, e);
    }

    try {
      SanitizedConfiguration sanitized = SanitizedConfiguration.fromUnsanitized(job);

      lockManager.validateIfLocked(
          ILockKey.build(LockKey.job(jobKey.newBuilder())),
          Optional.fromNullable(mutableLock).transform(ILock.FROM_BUILDER));

      if (!sanitized.isCron()) {
        return invalidResponse(noCronScheduleMessage(jobKey));
      }
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

      SessionKey session) {

    try {
      sessionValidator.checkAuthenticated(session, ImmutableSet.of(mutableJobKey.getRole()));

      IJobKey jobKey = JobKeys.assertValid(IJobKey.build(mutableJobKey));
      lockManager.validateIfLocked(
          ILockKey.build(LockKey.job(jobKey.newBuilder())),
          Optional.fromNullable(mutableLock).transform(ILock.FROM_BUILDER));

      if (!cronJobManager.deleteJob(jobKey)) {
        return invalidResponse(notScheduledCronMessage(jobKey));
      }
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

      @Nullable Lock mutableLock,
      SessionKey session) {

    requireNonNull(mutableConfig);
    IJobConfiguration job = IJobConfiguration.build(mutableConfig);
    IJobKey jobKey = JobKeys.assertValid(job.getKey());
    requireNonNull(session);

    try {
      sessionValidator.checkAuthenticated(session, ImmutableSet.of(jobKey.getRole()));
    } catch (AuthFailedException e) {
      return errorResponse(AUTH_FAILED, e);
    }

    try {
      lockManager.validateIfLocked(
          ILockKey.build(LockKey.job(jobKey.newBuilder())),
          Optional.fromNullable(mutableLock).transform(ILock.FROM_BUILDER));

      cronJobManager.updateJob(SanitizedCronJob.fromUnsanitized(job));
      return okEmptyResponse();
    } catch (LockException e) {
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

  }

  @Override
  public Response startCronJob(JobKey mutableJobKey, SessionKey session) {
    requireNonNull(session);
    IJobKey jobKey = JobKeys.assertValid(IJobKey.build(mutableJobKey));

    try {
      sessionValidator.checkAuthenticated(session, ImmutableSet.of(jobKey.getRole()));
    } catch (AuthFailedException e) {
      return errorResponse(AUTH_FAILED, e);
    }

    try {
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

    return okResponse(Result.getPendingReasonResult(new GetPendingReasonResult(reasons)));
  }

  @Override
  public Response getConfigSummary(JobKey job) throws TException {
    IJobKey jobKey = JobKeys.assertValid(IJobKey.build(job));

    Set<IScheduledTask> activeTasks =
        Storage.Util.weaklyConsistentFetchTasks(storage, Query.jobScoped(jobKey).active());

    Iterable<IAssignedTask> assignedTasks =
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

        final boolean cronJobKilled;
        if (isSingleJobScoped) {
          // If this looks like a query for all tasks in a job, instruct the cron
          // scheduler to delete it.
          // TODO(mchucarroll): deprecate cron as a part of create/kill job.  (AURORA-454)
          IJobKey jobKey = Iterables.getOnlyElement(JobKeys.from(query).get());
          LOG.warning("Deprecated behavior: descheduling job " + jobKey
              + " with cron via killTasks. (See AURORA-454)");
          cronJobKilled = cronJobManager.deleteJob(jobKey);
        } else {
          cronJobKilled = false;
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

      JobKey mutableJobKey,
      final Set<Integer> shardIds,
      @Nullable final Lock mutableLock,
      SessionKey session) {

    final IJobKey jobKey = JobKeys.assertValid(IJobKey.build(mutableJobKey));
    checkNotBlank(shardIds);
    requireNonNull(session);

    final SessionContext context;
    try {
      context = sessionValidator.checkAuthenticated(session, ImmutableSet.of(jobKey.getRole()));
    } catch (AuthFailedException e) {
      return errorResponse(AUTH_FAILED, e);
    }

    return storage.write(new MutateWork.Quiet<Response>() {
      @Override
      public Response apply(MutableStoreProvider storeProvider) {
        try {
          lockManager.validateIfLocked(
              ILockKey.build(LockKey.job(jobKey.newBuilder())),
              Optional.fromNullable(mutableLock).transform(ILock.FROM_BUILDER));
        } catch (LockException e) {
          return errorResponse(LOCK_ERROR, e);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.