Examples of ScheduledTask


Examples of org.apache.aurora.gen.ScheduledTask

  public void testPreemptWithOfferAndTask() throws Exception {
    schedulingFilter = new SchedulingFilterImpl(storageUtil.storage, maintenance);

    setUpHost(HOST_A, RACK_A);

    ScheduledTask a1 = makeTask(USER_A, JOB_A, TASK_ID_A + "_a1");
    a1.getAssignedTask().getTask().setNumCpus(1).setRamMb(512);
    runOnHost(a1, HOST_A);

    Offer o1 = makeOffer(OFFER_A, HOST_A, 1, Amount.of(512L, Data.MB), Amount.of(1L, Data.MB), 1);
    expectOffers(o1);

    ScheduledTask p1 = makeProductionTask(USER_B, JOB_B, TASK_ID_B + "_p1");
    p1.getAssignedTask().getTask().setNumCpus(2).setRamMb(1024);

    clock.advance(PREEMPTION_DELAY);

    expectGetActiveTasks(a1);
    expectGetPendingTasks(p1);
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

  public void testPreemptWithOfferAndMultipleTasks() throws Exception {
    schedulingFilter = new SchedulingFilterImpl(storageUtil.storage, maintenance);

    setUpHost(HOST_A, RACK_A);

    ScheduledTask a1 = makeTask(USER_A, JOB_A, TASK_ID_A + "_a1");
    a1.getAssignedTask().getTask().setNumCpus(1).setRamMb(512);
    runOnHost(a1, HOST_A);

    ScheduledTask a2 = makeTask(USER_A, JOB_B, TASK_ID_A + "_a2");
    a2.getAssignedTask().getTask().setNumCpus(1).setRamMb(512);
    runOnHost(a2, HOST_A);

    Offer o1 = makeOffer(OFFER_A, HOST_A, 2, Amount.of(1024L, Data.MB), Amount.of(1L, Data.MB), 1);
    expectOffers(o1);

    ScheduledTask p1 = makeProductionTask(USER_B, JOB_B, TASK_ID_B + "_p1");
    p1.getAssignedTask().getTask().setNumCpus(4).setRamMb(2048);

    clock.advance(PREEMPTION_DELAY);

    expectGetActiveTasks(a1, a2);
    expectGetPendingTasks(p1);
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

  public void testPreemptWithLargeOffer() throws Exception {
    schedulingFilter = new SchedulingFilterImpl(storageUtil.storage, maintenance);

    setUpHost(HOST_A, RACK_A);

    ScheduledTask a1 = makeTask(USER_A, JOB_A, TASK_ID_A + "_a1");
    a1.getAssignedTask().getTask().setNumCpus(1).setRamMb(512);
    runOnHost(a1, HOST_A);

    Offer o1 = makeOffer(OFFER_A, HOST_A, 2, Amount.of(2048L, Data.MB), Amount.of(1L, Data.MB), 1);
    expectOffers(o1);

    ScheduledTask p1 = makeProductionTask(USER_B, JOB_B, TASK_ID_B + "_p1");
    p1.getAssignedTask().getTask().setNumCpus(1).setRamMb(1024);

    clock.advance(PREEMPTION_DELAY);

    expectGetActiveTasks(a1);
    expectGetPendingTasks(p1);
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

    // Ensures that the preemptor does not consider a throttled task to be a preemption candidate.
    schedulingFilter = createMock(SchedulingFilter.class);

    Storage storage = MemStorage.newEmptyStorage();

    final ScheduledTask throttled = makeTask(USER_A, JOB_A, TASK_ID_A + "_a1").setStatus(THROTTLED);
    throttled.getAssignedTask().getTask().setNumCpus(1).setRamMb(512);

    final ScheduledTask pending = makeProductionTask(USER_B, JOB_B, TASK_ID_B + "_p1");
    pending.getAssignedTask().getTask().setNumCpus(1).setRamMb(1024);

    storage.write(new MutateWork.NoResult.Quiet() {
      @Override
      protected void execute(MutableStoreProvider store) {
        store.getUnsafeTaskStore().saveTasks(ImmutableSet.of(
            IScheduledTask.build(pending),
            IScheduledTask.build(throttled)));
      }
    });

    clock.advance(PREEMPTION_DELAY);

    control.replay();

    PreemptorImpl preemptor = new PreemptorImpl(
        storage,
        stateManager,
        offerQueue,
        schedulingFilter,
        PREEMPTION_DELAY,
        clock);

    assertEquals(
        Optional.<String>absent(),
        preemptor.findPreemptionSlotFor(pending.getAssignedTask().getTaskId(), emptyJob));
  }
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

            .setPriority(priority)
            .setProduction(production)
            .setJobName(job)
            .setEnvironment(env)
            .setConstraints(new HashSet<Constraint>()));
    ScheduledTask scheduledTask = new ScheduledTask()
        .setStatus(PENDING)
        .setAssignedTask(assignedTask);
    addEvent(scheduledTask, PENDING);
    return scheduledTask;
  }
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

    Task stored = tasks.get(taskId);
    if (stored == null) {
      return false;
    } else {
      ScheduledTask updated = stored.storedTask.newBuilder();
      updated.getAssignedTask().setTask(taskConfiguration.newBuilder());
      tasks.put(taskId, toTask.apply(IScheduledTask.build(updated)));
      return true;
    }
  }
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

      int cpus,
      int ramMb,
      int diskMb,
      boolean production) {

    return IScheduledTask.build(new ScheduledTask()
        .setStatus(ScheduleStatus.RUNNING)
        .setAssignedTask(
            new AssignedTask()
                .setTaskId(taskId)
                .setTask(new TaskConfig()
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

    return new Snapshot()
        .setTimestamp(1L)
        .setHostAttributes(ImmutableSet.of(new HostAttributes("host",
            ImmutableSet.of(new Attribute("hostname", ImmutableSet.of("abc"))))))
        .setTasks(ImmutableSet.of(
            new ScheduledTask().setStatus(ScheduleStatus.RUNNING)
                .setAssignedTask(new AssignedTask().setTaskId("task_id")
                    .setTask(new TaskConfig().setJobName("job_name")))));
  }
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

  private SaveTasks createSaveTasks(String... taskIds) {
    return new SaveTasks(ImmutableSet.copyOf(Iterables.transform(ImmutableList.copyOf(taskIds),
        new Function<String, ScheduledTask>() {
          @Override
          public ScheduledTask apply(String taskId) {
            return new ScheduledTask().setAssignedTask(new AssignedTask().setTaskId(taskId));
          }
        })));
  }
View Full Code Here

Examples of org.apache.aurora.gen.ScheduledTask

    Capture<Runnable> snapshotAction = createCapture();
    schedulingService.doEvery(eq(SNAPSHOT_INTERVAL), capture(snapshotAction));
    Snapshot snapshotContents = new Snapshot()
        .setTimestamp(NOW)
        .setTasks(ImmutableSet.of(
            new ScheduledTask()
                .setStatus(ScheduleStatus.RUNNING)
                .setAssignedTask(new AssignedTask().setTaskId("task_id"))));
    expect(snapshotStore.createSnapshot()).andReturn(snapshotContents);
    streamMatcher.expectSnapshot(snapshotContents).andReturn(position);
    stream.truncateBefore(position);
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.