Package org.apache.aurora.scheduler.storage.entities

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


            .build());
  }

  @Test
  public void testLatestTransitionedTasks() {
    IScheduledTask f1 = makeTask(FINISHED, makeTaskEvents(100, FINISHED));
    IScheduledTask f2 = makeTask(FINISHED, makeTaskEvents(200, FINISHED));
    IScheduledTask f3 = makeTask(FINISHED, makeTaskEvents(300, FINISHED));
    IScheduledTask r1 = makeTask(RUNNING, makeTaskEvents(400, RUNNING));
    IScheduledTask r2 = makeTask(RUNNING, makeTaskEvents(500, RUNNING));
    IScheduledTask r3 = makeTask(RUNNING, makeTaskEvents(600, RUNNING));

    try {
      getLatestActiveTask(ImmutableList.<IScheduledTask>of());
      fail("Should have thrown IllegalArgumentException.");
    } catch (IllegalArgumentException e) {
View Full Code Here


  }

  @Test
  public void testNoPruning() {
    long taskATimestamp = clock.nowMillis();
    IScheduledTask a = makeTask("a", FINISHED);

    clock.advance(ONE_MS);
    long taskBTimestamp = clock.nowMillis();
    IScheduledTask b = makeTask("b", SANDBOX_DELETED);

    expectNoImmediatePrune(ImmutableSet.of(a));
    expectOneDelayedPrune(taskATimestamp);
    expectNoImmediatePrune(ImmutableSet.of(a, b));
    expectOneDelayedPrune(taskBTimestamp);
View Full Code Here

  }

  @Test
  public void testStorageStartedWithPruning() {
    long taskATimestamp = clock.nowMillis();
    IScheduledTask a = makeTask("a", SANDBOX_DELETED);

    clock.advance(ONE_MINUTE);
    long taskBTimestamp = clock.nowMillis();
    IScheduledTask b = makeTask("b", LOST);

    clock.advance(ONE_MINUTE);
    long taskCTimestamp = clock.nowMillis();
    IScheduledTask c = makeTask("c", FINISHED);

    clock.advance(ONE_MINUTE);
    IScheduledTask d = makeTask("d", FINISHED);
    IScheduledTask e = makeTask("job-x", "e", FINISHED);

    expectNoImmediatePrune(ImmutableSet.of(a));
    expectOneDelayedPrune(taskATimestamp);
    expectNoImmediatePrune(ImmutableSet.of(a, b));
    expectOneDelayedPrune(taskBTimestamp);
View Full Code Here

    }
  }

  @Test
  public void testStateChange() {
    IScheduledTask starting = makeTask("a", STARTING);
    IScheduledTask running = copy(starting, RUNNING);
    IScheduledTask killed = copy(starting, KILLED);

    expectNoImmediatePrune(ImmutableSet.of(killed));
    expectDefaultDelayedPrune();

    control.replay();
View Full Code Here

    changeState(running, killed);
  }

  @Test
  public void testActivateFutureAndExceedHistoryGoal() {
    IScheduledTask running = makeTask("a", RUNNING);
    IScheduledTask killed = copy(running, KILLED);
    expectNoImmediatePrune(ImmutableSet.of(running));
    Capture<Runnable> delayedDelete = expectDefaultDelayedPrune();

    // Expect task "a" to be pruned when future is activated.
    expectDeleteTasks("a");
View Full Code Here

    delayedDelete.getValue().run();
  }

  @Test
  public void testJobHistoryExceeded() {
    IScheduledTask a = makeTask("a", RUNNING);
    clock.advance(ONE_MS);
    IScheduledTask aKilled = copy(a, KILLED);

    IScheduledTask b = makeTask("b", RUNNING);
    clock.advance(ONE_MS);
    IScheduledTask bKilled = copy(b, KILLED);

    IScheduledTask c = makeTask("c", RUNNING);
    clock.advance(ONE_MS);
    IScheduledTask cLost = copy(c, LOST);

    IScheduledTask d = makeTask("d", RUNNING);
    clock.advance(ONE_MS);
    IScheduledTask dLost = copy(d, LOST);

    expectNoImmediatePrune(ImmutableSet.of(a));
    expectDefaultDelayedPrune();
    expectNoImmediatePrune(ImmutableSet.of(a, b));
    expectDefaultDelayedPrune();
View Full Code Here

    pruner = prunerWithRealExecutor();
    Command onDeleted = new Command() {
      @Override
      public void execute() {
        // The goal is to verify that the call does not deadlock. We do not care about the outcome.
        IScheduledTask b = makeTask("b", ASSIGNED);

        changeState(b, STARTING);
      }
    };
    CountDownLatch taskDeleted = expectTaskDeleted(onDeleted, TASK_ID);
View Full Code Here

  public void testNoEarlyExport() {
    control.replay();

    // No variables should be exported since schedulerActive is never called.
    vars = new TaskVars(storageUtil.storage, trackedStats);
    IScheduledTask taskA = makeTask(JOB_A, INIT);
    changeState(taskA, PENDING);
    changeState(IScheduledTask.build(taskA.newBuilder().setStatus(PENDING)), ASSIGNED);
  }
View Full Code Here

  @Test
  public void testTaskLifeCycle() {
    expectStatusCountersInitialized();

    IScheduledTask taskA = makeTask(JOB_A, INIT);
    expectGetHostRack("hostA", "rackA").atLeastOnce();
    expectStatExport(rackStatName("rackA"));

    control.replay();
    schedulerActivated();

    changeState(makeTask(JOB_A, INIT), PENDING);
    assertEquals(1, getValue(PENDING));
    changeState(IScheduledTask.build(taskA.newBuilder().setStatus(PENDING)), ASSIGNED);
    assertEquals(0, getValue(PENDING));
    assertEquals(1, getValue(ASSIGNED));
    taskA = makeTask(JOB_A, ASSIGNED, "hostA");
    changeState(IScheduledTask.build(taskA.newBuilder().setStatus(ASSIGNED)), RUNNING);
    assertEquals(0, getValue(ASSIGNED));
    assertEquals(1, getValue(RUNNING));
    changeState(IScheduledTask.build(taskA.newBuilder().setStatus(RUNNING)), FINISHED);
    assertEquals(0, getValue(RUNNING));
    assertEquals(1, getValue(FINISHED));
    assertEquals(0, getValue(rackStatName("rackA")));
    vars.tasksDeleted(new TasksDeleted(ImmutableSet.of(
        IScheduledTask.build(taskA.newBuilder().setStatus(FINISHED)))));
    assertAllZero();
  }
View Full Code Here

    expectStatExport(rackStatName("rackB"));

    control.replay();
    schedulerActivated();

    IScheduledTask a = makeTask("jobA", RUNNING, "host1");
    IScheduledTask b = makeTask("jobB", RUNNING, "host2");
    IScheduledTask c = makeTask("jobC", RUNNING, "host3");
    IScheduledTask d = makeTask("jobD", RUNNING, "host1");

    changeState(a, LOST);
    changeState(b, LOST);
    changeState(c, LOST);
    changeState(d, LOST);
View Full Code Here

TOP

Related Classes of org.apache.aurora.scheduler.storage.entities.IScheduledTask

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.