Package org.apache.aurora.gen

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


            .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

    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

      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

    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

  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

    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

    return LogEntry.transaction(
        new Transaction(ImmutableList.copyOf(ops), storageConstants.CURRENT_SCHEMA_VERSION));
  }

  private static IScheduledTask task(String id, ScheduleStatus status) {
    return IScheduledTask.build(new ScheduledTask()
        .setStatus(status)
        .setAssignedTask(new AssignedTask()
            .setTaskId(id)
            .setTask(new TaskConfig())));
  }
View Full Code Here

        .setTasks(ImmutableSet.<ScheduledTask>builder().add(tasks).build())
        .setLocks(ImmutableSet.<Lock>of());
  }

  private static ScheduledTask makeTask(String taskId) {
    return new ScheduledTask().setAssignedTask(
        new AssignedTask()
            .setTaskId(taskId)
            .setTask(new TaskConfig()
                .setJobName("job-" + taskId)
                .setEnvironment("test")
View Full Code Here

            "jobManager",
            new JobConfiguration().setKey(new JobKey("owner", "env", "jobA")))));
    snapshot.setQuotaConfigurations(
        ImmutableSet.of(new QuotaConfiguration("roleA", new ResourceAggregate(10, 1024, 1024))));
    snapshot.setSchedulerMetadata(new SchedulerMetadata().setFrameworkId("frameworkId"));
    snapshot.setTasks(ImmutableSet.of(new ScheduledTask()));
    return snapshot;
  }
View Full Code Here

TOP

Related Classes of org.apache.aurora.gen.ScheduledTask

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.