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

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


  @Test
  public void testNoEarlyExport() {
    replayAndBuild();

    // No variables should be exported since schedulerActive is never called.
    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"));

    replayAndBuild();
    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

    expectGetHostRack("hostA", "rackA").atLeastOnce();
    expectGetHostRack("hostB", "rackB").atLeastOnce();
    expectStatExport(rackStatName("rackA"));
    expectStatExport(rackStatName("rackB"));

    IScheduledTask failedTask = makeTask(JOB_B, FAILED, "hostB");
    expectStatExport(jobStatName(failedTask, FAILED), untrackedProvider);

    replayAndBuild();
    schedulerActivated(
        makeTask(JOB_A, PENDING),
View Full Code Here

    expectGetHostRack("host3", "rackB").atLeastOnce();

    expectStatExport(rackStatName("rackA"));
    expectStatExport(rackStatName("rackB"));

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

    expectStatExport(jobStatName(a, LOST), untrackedProvider);
    expectStatExport(jobStatName(b, LOST), untrackedProvider);
    expectStatExport(jobStatName(c, LOST), untrackedProvider);
View Full Code Here

  public void testRackMissing() {
    expectStatusCountersInitialized();
    expect(storageUtil.attributeStore.getHostAttributes("a"))
        .andReturn(Optional.<IHostAttributes>absent());

    IScheduledTask a = makeTask(JOB_A, RUNNING, "a");
    expectStatExport(jobStatName(a, LOST), untrackedProvider);

    replayAndBuild();
    schedulerActivated();
View Full Code Here

    Capture<String> names = new Capture<>(CaptureType.ALL);
    expect(untracked.makeGauge(EasyMock.capture(names), EasyMock.<Supplier<Number>>anyObject()))
        .andReturn(EasyMock.<Stat<Number>>anyObject())
        .anyTimes();

    IScheduledTask task1 = makeTask(ImmutableMap.of(clock.nowMillis() - 1000, PENDING), 0);
    IScheduledTask task2 = makeTask(ImmutableMap.of(clock.nowMillis() - 2000, PENDING), 1);
    IScheduledTask task3 = makeTask(ImmutableMap.of(clock.nowMillis() - 3000, PENDING), 2);
    IScheduledTask task4 = makeTask(ImmutableMap.of(clock.nowMillis() - 4000, PENDING), 3, false);

    clock.advance(Amount.of(10L, Time.SECONDS));
    storageUtil.expectTaskFetch(Query.unscoped(), task1, task2, task3, task4);
    storageUtil.expectOperations();
View Full Code Here

  public void testBackfillTaskJob() throws Exception {
    TaskConfig task = defaultTask();
    ConfigurationManager.applyDefaultsIfUnset(task);
    task.unsetJob();

    IScheduledTask noJobKey = IScheduledTask.build(new ScheduledTask()
        .setStatus(RUNNING)
        .setAssignedTask(new AssignedTask()
            .setInstanceId(0)
            .setTaskId("nojobkey")
            .setTask(task)));
    IScheduledTask nullJobKeyFields = IScheduledTask.build(new ScheduledTask()
        .setStatus(RUNNING)
        .setAssignedTask(new AssignedTask()
            .setInstanceId(1)
            .setTaskId("nulled_fields")
            .setTask(task.setJob(new JobKey()))));

    final Set<IScheduledTask> backfilledTasks = ImmutableSet.of(noJobKey, nullJobKeyFields);
    storage.write(new Storage.MutateWork.NoResult.Quiet() {
      @Override
      protected void execute(Storage.MutableStoreProvider storeProvider) {
        storeProvider.getUnsafeTaskStore().saveTasks(backfilledTasks);
      }
    });

    backfill();
    ScheduledTask noJobKeyBackfilled = noJobKey.newBuilder();
    noJobKeyBackfilled.getAssignedTask().getTask()
        .setJob(new JobKey(OWNER.getRole(), ENV, JOB_NAME));

    ScheduledTask nullJobKeyFieldsBackfilled = nullJobKeyFields.newBuilder();
    nullJobKeyFieldsBackfilled.getAssignedTask().getTask()
        .setJob(new JobKey(OWNER.getRole(), ENV, JOB_NAME));

    assertEquals(
        ImmutableSet.of(
View Full Code Here

    Injector injector = getInjector(memStorage);
    scheduler = injector.getInstance(TaskScheduler.class);
    eventSink = PubsubTestUtil.startPubsub(injector);

    ScheduledTask builder = TASK_A.newBuilder();
    final IScheduledTask taskA = IScheduledTask.build(builder.setStatus(PENDING));
    builder.getAssignedTask().setTaskId("b");
    final IScheduledTask taskB = IScheduledTask.build(builder.setStatus(THROTTLED));

    memStorage.write(new MutateWork.NoResult.Quiet() {
      @Override
      protected void execute(MutableStoreProvider store) {
        store.getUnsafeTaskStore().saveTasks(ImmutableSet.of(taskA, taskB));
View Full Code Here

  }

  @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, "devel", "job_bar").newBuilder()));
    expectAuth(ROOT, false);
    expectAuth(ROLE, true);
    storageUtil.expectTaskFetch(query, buildScheduledTask(), task2);
View Full Code Here

  @Test
  public void testRewriteShardCasMismatch() throws Exception {
    TaskConfig storedConfig = productionTask();
    TaskConfig modifiedConfig =
        storedConfig.deepCopy().setExecutorConfig(new ExecutorConfig("aurora", "rewritten"));
    IScheduledTask storedTask = IScheduledTask.build(
        new ScheduledTask().setAssignedTask(new AssignedTask().setTask(storedConfig)));
    InstanceKey instance = new InstanceKey(
        JobKeys.from(
            storedConfig.getOwner().getRole(),
            storedConfig.getEnvironment(),
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.