Package org.apache.aurora.gen

Examples of org.apache.aurora.gen.JobUpdateInstructions


          return invalidResponse(
              "updateOnlyTheseInstances contains instances irrelevant to the update: "
                  + invalidScope);
        }

        JobUpdateInstructions instructions = new JobUpdateInstructions()
            .setSettings(settings.newBuilder())
            .setInitialState(buildInitialState(diff.getReplacedInstances()));
        if (!diff.getReplacementInstances().isEmpty()) {
          instructions.setDesiredState(
              new InstanceTaskConfig()
                  .setTask(request.getTaskConfig().newBuilder())
                  .setInstances(convertRanges(Numbers.toRanges(diff.getReplacementInstances()))));
        }
View Full Code Here


    return IJobUpdate.build(new JobUpdate()
        .setSummary(new JobUpdateSummary()
            .setJobKey(JOB_KEY.newBuilder())
            .setUpdateId(UPDATE_ID)
            .setUser(ROLE_IDENTITY.getUser()))
        .setInstructions(new JobUpdateInstructions()
            .setSettings(buildJobUpdateSettings())
            .setDesiredState(new InstanceTaskConfig()
                .setTask(newConfig.newBuilder())
                .setInstances(ImmutableSet.of(new Range(0, instanceCount - 1))))
            .setInitialState(builder.build())));
View Full Code Here

    assertEquals(ImmutableSet.of(0, 1, 2), update.getUpdater().getInstances());
  }

  @Test
  public void testRollForwardSpecificInstances() throws Exception {
    JobUpdateInstructions config = INSTRUCTIONS.newBuilder();
    config.getSettings().setUpdateOnlyTheseInstances(ImmutableSet.of(new Range(1, 2)));

    Update update = factory.newUpdate(IJobUpdateInstructions.build(config), true);
    assertEquals(ImmutableSet.of(1, 2), update.getUpdater().getInstances());
  }
View Full Code Here

    assertEquals(ImmutableSet.of(1, 2), update.getUpdater().getInstances());
  }

  @Test
  public void testRollBackSpecificInstances() throws Exception {
    JobUpdateInstructions config = INSTRUCTIONS.newBuilder();
    config.getSettings().setUpdateOnlyTheseInstances(ImmutableSet.of(new Range(1, 2)));

    Update update = factory.newUpdate(IJobUpdateInstructions.build(config), false);
    assertEquals(ImmutableSet.of(1, 2), update.getUpdater().getInstances());
  }
View Full Code Here

    assertEquals(ImmutableSet.of(1, 2), update.getUpdater().getInstances());
  }

  @Test
  public void testUpdateRemovesInstance() throws Exception {
    JobUpdateInstructions config = INSTRUCTIONS.newBuilder();
    config.getDesiredState().setInstances(ImmutableSet.of(new Range(0, 1)));

    Update update = factory.newUpdate(IJobUpdateInstructions.build(config), true);
    assertEquals(ImmutableSet.of(0, 1, 2), update.getUpdater().getInstances());
  }
View Full Code Here

    final IJobUpdate update = IJobUpdate.build(new JobUpdate()
        .setSummary(new JobUpdateSummary()
            .setUpdateId(updateId)
            .setJobKey(JOB_KEY.newBuilder())
            .setUser("user"))
        .setInstructions(new JobUpdateInstructions()
            .setDesiredState(new InstanceTaskConfig()
                .setTask(new TaskConfig())
                .setInstances(ImmutableSet.of(new Range(0, 3))))
            .setInitialState(ImmutableSet.of(new InstanceTaskConfig()
                .setTask(new TaskConfig())
View Full Code Here

  }

  private static IJobUpdate makeJobUpdate(IInstanceTaskConfig... configs) {
    JobUpdate builder = new JobUpdate()
        .setSummary(makeUpdateSummary().newBuilder())
        .setInstructions(new JobUpdateInstructions()
            .setDesiredState(new InstanceTaskConfig()
                .setTask(NEW_CONFIG.newBuilder())
                .setInstances(ImmutableSet.of(new Range(0, 2))))
            .setSettings(new JobUpdateSettings()
                .setUpdateGroupSize(1)
View Full Code Here

    return IJobUpdate.build(new JobUpdate()
        .setInstructions(makeJobUpdateInstructions().newBuilder()));
  }

  private IJobUpdateInstructions makeJobUpdateInstructions() {
    return IJobUpdateInstructions.build(new JobUpdateInstructions()
        .setDesiredState(new InstanceTaskConfig()
            .setTask(makeTaskConfig())
            .setInstances(ImmutableSet.of(new Range(0, 7), new Range(8, 9))))
        .setInitialState(ImmutableSet.of(
            new InstanceTaskConfig()
View Full Code Here

      ITaskConfig desired,
      int desiredInstances) {

    return IJobUpdate.build(new JobUpdate()
        .setSummary(summary.newBuilder())
        .setInstructions(new JobUpdateInstructions()
            .setDesiredState(new InstanceTaskConfig()
                .setTask(desired.newBuilder())
                .setInstances(ImmutableSet.of(new Range(0, desiredInstances - 1))))
            .setInitialState(ImmutableSet.of(new InstanceTaskConfig()
                .setTask(initial.newBuilder())
View Full Code Here

TOP

Related Classes of org.apache.aurora.gen.JobUpdateInstructions

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.