Examples of ScheduledTask


Examples of org.apache.aurora.gen.ScheduledTask

    expectAnyMaintenanceCalls();

    IScheduledTask jobA0 = makeTask("a0", PENDING);

    ScheduledTask jobA1Builder = jobA0.newBuilder();
    jobA1Builder.getAssignedTask().setTaskId("a1");
    jobA1Builder.getAssignedTask().setInstanceId(1);
    IScheduledTask jobA1 = IScheduledTask.build(jobA1Builder);

    ScheduledTask jobA2Builder = jobA0.newBuilder();
    jobA2Builder.getAssignedTask().setTaskId("a2");
    jobA2Builder.getAssignedTask().setInstanceId(2);
    IScheduledTask jobA2 = IScheduledTask.build(jobA2Builder);

    IScheduledTask jobB0 = makeTask("b0", PENDING);

    expectOfferDeclineIn(10);
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

          }
        });
  }

  private static ScheduledTask makeTask(String id, ScheduleStatus status) {
    ScheduledTask scheduledTask = new ScheduledTask()
        .setStatus(status)
        .setTaskEvents(ImmutableList.of(new TaskEvent(100, status)))
        .setAssignedTask(new AssignedTask()
            .setTaskId(id)
            .setTask(new TaskConfig()
                .setJobName("job-" + id)
                .setEnvironment("test")
                .setExecutorConfig(new org.apache.aurora.gen.ExecutorConfig("AuroraExecutor", ""))
                .setOwner(new Identity("role-" + id, "user-" + id))));
    // Apply defaults here so that we can expect the same task that will be written to the stream.
    ConfigurationManager.applyDefaultsIfUnset(scheduledTask.getAssignedTask().getTask());
    return scheduledTask;
  }
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

  @Test
  public void testLaunch() throws Exception {
    expect(driverFactory.apply(null)).andReturn(driver).anyTimes();

    ScheduledTask snapshotTask = makeTask("snapshotTask", ScheduleStatus.ASSIGNED);
    ScheduledTask transactionTask = makeTask("transactionTask", ScheduleStatus.RUNNING);
    Iterable<Entry> recoveredEntries = toEntries(
        LogEntry.snapshot(new Snapshot().setTasks(ImmutableSet.of(snapshotTask))),
        LogEntry.transaction(new Transaction(
            ImmutableList.of(Op.saveTasks(new SaveTasks(ImmutableSet.of(transactionTask)))),
            storageConstants.CURRENT_SCHEMA_VERSION)));
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

    maintenance = injector.getInstance(MaintenanceController.class);
    eventSink = PubsubTestUtil.startPubsub(injector);
  }

  private static ScheduledTask makeTask(String host, String taskId) {
    return new ScheduledTask()
        .setStatus(RUNNING)
        .setAssignedTask(
            new AssignedTask()
                .setSlaveHost(host)
                .setTaskId(taskId)
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

                        .setOwner(new Identity().setRole("role").setUser("role"))));
  }

  @Test
  public void testMaintenanceCycle() {
    ScheduledTask task = makeTask(HOST_A, "taskA");

    expectMaintenanceModeChange(HOST_A, SCHEDULED);
    expectFetchTasksByHost(HOST_A, ImmutableSet.of(task));
    expect(stateManager.changeState(
        Tasks.id(task),
        Optional.<ScheduleStatus>absent(),
        ScheduleStatus.DRAINING,
        MaintenanceControllerImpl.DRAINING_MESSAGE))
        .andReturn(true);
    expectMaintenanceModeChange(HOST_A, DRAINING);
    expect(storageUtil.attributeStore.getHostAttributes(HOST_A)).andReturn(Optional.of(
        IHostAttributes.build(new HostAttributes().setHost(HOST_A).setMode(DRAINING))));
    // TaskA is FINISHED and therefore no longer active
    expectFetchTasksByHost(HOST_A, ImmutableSet.<ScheduledTask>of());
    expectMaintenanceModeChange(HOST_A, DRAINED);
    expectMaintenanceModeChange(HOST_A, NONE);

    control.replay();

    assertStatus(HOST_A, SCHEDULED, maintenance.startMaintenance(A));
    assertStatus(HOST_A, DRAINING, maintenance.drain(A));
    eventSink.post(
        TaskStateChange.transition(IScheduledTask.build(task.setStatus(FINISHED)), RUNNING));
    assertStatus(HOST_A, NONE, maintenance.endMaintenance(A));
  }
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

  }

  @Test
  public void testPreempted() throws Exception {
    schedulingFilter = createMock(SchedulingFilter.class);
    ScheduledTask lowPriority = makeTask(USER_A, JOB_A, TASK_ID_A);
    runOnHost(lowPriority, HOST_A);

    ScheduledTask highPriority = makeTask(USER_A, JOB_A, TASK_ID_B, 100);
    clock.advance(PREEMPTION_DELAY);

    expectNoOffers();

    expectGetPendingTasks(highPriority);
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

  }

  @Test
  public void testLowestPriorityPreempted() throws Exception {
    schedulingFilter = createMock(SchedulingFilter.class);
    ScheduledTask lowPriority = makeTask(USER_A, JOB_A, TASK_ID_A, 10);
    runOnHost(lowPriority, HOST_A);

    ScheduledTask lowerPriority = makeTask(USER_A, JOB_A, TASK_ID_B, 1);
    runOnHost(lowerPriority, HOST_A);

    ScheduledTask highPriority = makeTask(USER_A, JOB_A, TASK_ID_C, 100);
    clock.advance(PREEMPTION_DELAY);

    expectNoOffers();

    expectGetPendingTasks(highPriority);
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

    assertNearest();
  }

  private IScheduledTask makeTask() {
    return IScheduledTask.build(
        new ScheduledTask().setAssignedTask(new AssignedTask().setTaskId(TASK)));
  }
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

  }

  @Test
  public void testOnePreemptableTask() throws Exception {
    schedulingFilter = createMock(SchedulingFilter.class);
    ScheduledTask highPriority = makeTask(USER_A, JOB_A, TASK_ID_A, 100);
    runOnHost(highPriority, HOST_A);

    ScheduledTask lowerPriority = makeTask(USER_A, JOB_A, TASK_ID_B, 99);
    runOnHost(lowerPriority, HOST_A);

    ScheduledTask lowestPriority = makeTask(USER_A, JOB_A, TASK_ID_C, 1);
    runOnHost(lowestPriority, HOST_A);

    ScheduledTask pendingPriority = makeTask(USER_A, JOB_A, TASK_ID_D, 98);
    clock.advance(PREEMPTION_DELAY);

    expectNoOffers();

    expectGetPendingTasks(pendingPriority);
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

  @Test
  public void testStateChanged() {
    vetoed(ALMOST);
    assertNearest(ALMOST);
    IScheduledTask task = IScheduledTask.build(new ScheduledTask()
        .setStatus(ScheduleStatus.ASSIGNED)
        .setAssignedTask(new AssignedTask().setTaskId(TASK)));
    nearest.stateChanged(TaskStateChange.transition(task, ScheduleStatus.PENDING));
    assertNearest();
  }
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.