Examples of IScheduledTask


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

    }.run();
  }

  @Test
  public void testRemoveTasksQuery() throws Exception {
    final IScheduledTask task = task("a", ScheduleStatus.FINISHED);
    final Set<String> taskIds = Tasks.ids(task);
    new MutationFixture() {
      @Override
      protected void setupExpectations() throws Exception {
        storageUtil.expectWriteOperation();
View Full Code Here

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

    store.saveTasks(ImmutableSet.of(TASK_C, TASK_D));
    assertStoreContents(TASK_A, TASK_B, TASK_C, TASK_D);

    // Saving the same task should overwrite.
    IScheduledTask taskAModified =
        IScheduledTask.build(TASK_A.newBuilder().setStatus(RUNNING));
    store.saveTasks(ImmutableSet.of(taskAModified));
    assertStoreContents(taskAModified, TASK_B, TASK_C, TASK_D);
  }
View Full Code Here

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

  @Test
  public void testQueryBySlaveHost() {
    String hostA = "slaveA";
    String hostB = "slaveB";
    final IScheduledTask a = setHost(makeTask("a", "role", "env", "job"), Optional.of(hostA));
    final IScheduledTask b = setHost(makeTask("b", "role", "env", "job"), Optional.of(hostB));
    store.saveTasks(ImmutableSet.of(a, b));

    assertQueryResults(Query.slaveScoped(hostA), a);
    assertQueryResults(Query.slaveScoped(hostA, hostB), a, b);
  }
View Full Code Here

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

    assertStoreContents();
  }

  @Test
  public void testConsistentJobIndex() {
    final IScheduledTask a = makeTask("a", "jim", "test", "job");
    final IScheduledTask b = makeTask("b", "jim", "test", "job");
    final IScheduledTask c = makeTask("c", "jim", "test", "job2");
    final IScheduledTask d = makeTask("d", "joe", "test", "job");
    final IScheduledTask e = makeTask("e", "jim", "prod", "job");
    final Query.Builder jimsJob = Query.jobScoped(JobKeys.from("jim", "test", "job"));
    final Query.Builder jimsJob2 = Query.jobScoped(JobKeys.from("jim", "test", "job2"));
    final Query.Builder joesJob = Query.jobScoped(JobKeys.from("joe", "test", "job"));

    store.saveTasks(ImmutableSet.of(a, b, c, d, e));
    assertQueryResults(jimsJob, a, b);
    assertQueryResults(jimsJob2, c);
    assertQueryResults(joesJob, d);

    store.deleteTasks(ImmutableSet.of(Tasks.id(b)));
    assertQueryResults(jimsJob, a);
    assertQueryResults(jimsJob2, c);
    assertQueryResults(joesJob, d);

    store.mutateTasks(jimsJob, new TaskMutation() {
      @Override
      public IScheduledTask apply(IScheduledTask task) {
        return IScheduledTask.build(task.newBuilder().setStatus(RUNNING));
      }
    });
    IScheduledTask aRunning = IScheduledTask.build(a.newBuilder().setStatus(RUNNING));
    assertQueryResults(jimsJob, aRunning);
    assertQueryResults(jimsJob2, c);
    assertQueryResults(joesJob, d);

    store.deleteTasks(ImmutableSet.of(Tasks.id(d)));
View Full Code Here

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

    assertQueryResults(joesJob);
  }

  @Test
  public void testCanonicalTaskConfigs() {
    IScheduledTask a = makeTask("a", "role", "env", "job");
    IScheduledTask b = makeTask("a", "role", "env", "job");
    IScheduledTask c = makeTask("a", "role", "env", "job");
    Set<IScheduledTask> inserted = ImmutableSet.of(a, b, c);

    store.saveTasks(inserted);
    Set<ITaskConfig> storedConfigs = FluentIterable.from(store.fetchTasks(Query.unscoped()))
        .transform(Tasks.SCHEDULED_TO_INFO)
View Full Code Here

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

    return IScheduledTask.build(builder);
  }

  @Test
  public void testAddSlaveHost() {
    final IScheduledTask a = makeTask("a", "role", "env", "job");
    store.saveTasks(ImmutableSet.of(a));
    String host = "slaveA";
    assertQueryResults(Query.slaveScoped(host));

    final IScheduledTask b = setHost(a, Optional.of(host));
    Set<IScheduledTask> result = store.mutateTasks(Query.taskScoped(Tasks.id(a)),
        new Function<IScheduledTask, IScheduledTask>() {
          @Override
          public IScheduledTask apply(IScheduledTask task) {
            assertEquals(a, task);
            return b;
          }
        });
    assertEquals(ImmutableSet.of(b), result);
    assertQueryResults(Query.slaveScoped(host), b);

    // Unrealistic behavior, but proving that the secondary index can handle key mutations.
    String host2 = "slaveA2";
    final IScheduledTask c = setHost(b, Optional.of(host2));
    Set<IScheduledTask> result2 = store.mutateTasks(Query.taskScoped(Tasks.id(a)),
        new Function<IScheduledTask, IScheduledTask>() {
          @Override
          public IScheduledTask apply(IScheduledTask task) {
            assertEquals(b, task);
View Full Code Here

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

  @Test
  public void testUnsetSlaveHost() {
    // Unrealistic behavior, but proving that the secondary index does not become stale.

    String host = "slaveA";
    final IScheduledTask a = setHost(makeTask("a", "role", "env", "job"), Optional.of(host));
    store.saveTasks(ImmutableSet.of(a));
    assertQueryResults(Query.slaveScoped(host), a);

    final IScheduledTask b = setHost(a, Optional.<String>absent());
    Set<IScheduledTask> result = store.mutateTasks(Query.taskScoped(Tasks.id(a)),
        new Function<IScheduledTask, IScheduledTask>() {
          @Override
          public IScheduledTask apply(IScheduledTask task) {
            assertEquals(a, task);
View Full Code Here

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

  }

  @Test
  public void testTasksOnSameHost() {
    String host = "slaveA";
    final IScheduledTask a = setHost(makeTask("a", "role", "env", "job"), Optional.of(host));
    final IScheduledTask b = setHost(makeTask("b", "role", "env", "job"), Optional.of(host));
    store.saveTasks(ImmutableSet.of(a, b));
    assertQueryResults(Query.slaveScoped(host), a, b);
  }
View Full Code Here

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

  public void testSaveOverwrites() {
    // Ensures that saving a task with an existing task ID is effectively the same as a mutate,
    // and does not result in a duplicate object in the primary or secondary index.

    String host = "slaveA";
    final IScheduledTask a = setHost(makeTask("a", "role", "env", "job"), Optional.of(host));
    store.saveTasks(ImmutableSet.of(a));

    final IScheduledTask updated = setConfigData(a, "new config data");
    store.saveTasks(ImmutableSet.of(updated));
    assertQueryResults(Query.taskScoped(Tasks.id(a)), updated);
    assertQueryResults(Query.slaveScoped(host), updated);
  }
View Full Code Here

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

  }

  @Test
  public void testKillTasksLockCheckFailed() throws Exception {
    Query.Builder query = Query.unscoped().byJob(JOB_KEY).active();
    IScheduledTask task2 = buildScheduledTask("job_bar", TASK_ID);
    ILockKey key2 = ILockKey.build(LockKey.job(
        JobKeys.from(ROLE, DEFAULT_ENVIRONMENT, "job_bar").newBuilder()));
    expectAuth(ROOT, false);
    expectAuth(ROLE, true);
    storageUtil.expectTaskFetch(query, buildScheduledTask(), task2);
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.