Examples of IJobUpdateSummary


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

    storage.write(new MutateWork.NoResult<UpdateStateException>() {
      @Override
      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(
            update,
            Optional.of(requireNonNull(lock.getToken())));

        recordAndChangeJobUpdateStatus(
            storeProvider,
            summary.getUpdateId(),
            job,
            ROLLING_FORWARD,
            Optional.of(updatingUser));
      }
    });
View Full Code Here

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

    storage.write(new MutateWork.NoResult<UpdateStateException>() {
      @Override
      protected void execute(MutableStoreProvider storeProvider)
          throws UpdateStateException {

        IJobUpdateSummary update = Iterables.getOnlyElement(
            storeProvider.getJobUpdateStore().fetchJobUpdateSummaries(queryByJob(job)), null);
        if (update == null) {
          throw new UpdateStateException("There is no active update for " + job);
        }

        JobUpdateStatus status = update.getState().getStatus();
        JobUpdateStatus newStatus = requireNonNull(stateChange.apply(status));
        changeUpdateStatus(storeProvider, update, newStatus, user);
      }
    });
  }
View Full Code Here

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

      @Override
      public void run() {
        storage.write(new MutateWork.NoResult.Quiet() {
          @Override
          protected void execute(MutableStoreProvider storeProvider) {
            IJobUpdateSummary summary =
                getOnlyMatch(storeProvider.getJobUpdateStore(), queryByUpdateId(updateId));
            JobUpdateStatus status = summary.getState().getStatus();
            // Suppress this evaluation if the updater is not currently active.
            if (JobUpdateStateMachine.isActive(status)) {
              UpdateFactory.Update update = updates.get(instance.getJobKey());
              evaluateUpdater(
                  storeProvider,
View Full Code Here

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

    IJobKey job1 = JobKeys.from(role1, "env", "name1");
    IJobKey job2 = JobKeys.from(role1, "env", "name2");
    IJobKey job3 = JobKeys.from(role1, "env", "name3");
    IJobKey job4 = JobKeys.from(role1, "env", "name4");
    IJobKey job5 = JobKeys.from("role", "env", "name5");
    IJobUpdateSummary s1 =
        saveSummary(job1, "u1", 1230L, ROLLED_BACK, "user", Optional.of("lock1"));
    IJobUpdateSummary s2 =  saveSummary(job2, "u2", 1231L, ABORTED, "user", Optional.of("lock2"));
    IJobUpdateSummary s3 = saveSummary(job3, "u3", 1239L, ERROR, "user2", Optional.of("lock3"));
    IJobUpdateSummary s4 =
        saveSummary(job4, "u4", 1234L, ROLL_BACK_PAUSED, "user3", Optional.of("lock4"));
    IJobUpdateSummary s5 =
        saveSummary(job5, "u5", 1235L, ROLLING_FORWARD, "user4", Optional.of("lock5"));

    // Test empty query returns all.
    assertEquals(ImmutableList.of(s3, s5, s4, s2, s1), getSummaries(new JobUpdateQuery()));
View Full Code Here

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

      Long modifiedTimestampMs,
      JobUpdateStatus status,
      String user,
      Optional<String> lockToken) {

    IJobUpdateSummary summary = IJobUpdateSummary.build(new JobUpdateSummary()
        .setUpdateId(updateId)
        .setJobKey(jobKey.newBuilder())
        .setUser(user));

    IJobUpdate update = makeJobUpdate(summary);
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.