Package org.apache.aurora.gen

Examples of org.apache.aurora.gen.ScheduledTask


    return makeTask(events, instanceId, true);
  }

  static IScheduledTask makeTask(Map<Long, ScheduleStatus> events, int instanceId, boolean isProd) {
    List<ITaskEvent> taskEvents = makeEvents(events);
    return IScheduledTask.build(new ScheduledTask()
        .setStatus(Iterables.getLast(taskEvents).getStatus())
        .setTaskEvents(ITaskEvent.toBuildersList(taskEvents))
        .setAssignedTask(new AssignedTask()
            .setTaskId("task_Id")
            .setSlaveHost("host")
View Full Code Here


    storage.write(new Storage.MutateWork.NoResult.Quiet() {
      @Override
      protected void execute(Storage.MutableStoreProvider storeProvider) {
        storeProvider.getUnsafeTaskStore().saveTasks(ImmutableSet.of(
            IScheduledTask.build(new ScheduledTask()
                .setStatus(SANDBOX_DELETED)
                .setTaskEvents(ImmutableList.of(expectedEvent, new TaskEvent(200, SANDBOX_DELETED)))
                .setAssignedTask(new AssignedTask()
                    .setTaskId(TASK_ID)
                    .setInstanceId(0)
View Full Code Here

    storage.write(new Storage.MutateWork.NoResult.Quiet() {
      @Override
      protected void execute(Storage.MutableStoreProvider storeProvider) {
        storeProvider.getUnsafeTaskStore().saveTasks(ImmutableSet.of(
            IScheduledTask.build(new ScheduledTask()
                .setStatus(PENDING)
                .setTaskEvents(ImmutableList.of(new TaskEvent(100, PENDING)))
                .setAssignedTask(new AssignedTask()
                    .setTaskId(TASK_ID)
                    .setInstanceId(0)
View Full Code Here

    final Set<IScheduledTask> badTasks = ImmutableSet.copyOf(Iterables.transform(
        job.getInstanceIds(),
        new Function<Integer, IScheduledTask>() {
          @Override
          public IScheduledTask apply(Integer instanceId) {
            return IScheduledTask.build(new ScheduledTask()
                .setStatus(RUNNING)
                .setAssignedTask(new AssignedTask()
                    .setInstanceId(0)
                    .setTaskId("task-" + taskId.incrementAndGet())
                    .setTask(task)));
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(
            IScheduledTask.build(noJobKeyBackfilled),
View Full Code Here

  public void testMutate() {
    Query.Builder query = Query.taskScoped("a");
    Function<IScheduledTask, IScheduledTask> mutator =
        createMock(new Clazz<Function<IScheduledTask, IScheduledTask>>() { });
    ImmutableSet<IScheduledTask> mutated = ImmutableSet.of(IScheduledTask.build(
            new ScheduledTask().setAssignedTask(new AssignedTask().setTaskId("a"))));

    expect(taskStore.mutateTasks(query, mutator)).andReturn(mutated);
    expect(log.isLoggable(Level.FINE)).andReturn(false);
    expectOp(Op.saveTasks(new SaveTasks(IScheduledTask.toBuildersSet(mutated))));
View Full Code Here

  }

  @Test
  public void testCreateAndRestoreNewSnapshot() {
    ImmutableSet<IScheduledTask> tasks = ImmutableSet.of(
        IScheduledTask.build(new ScheduledTask().setStatus(ScheduleStatus.PENDING)));
    Set<QuotaConfiguration> quotas =
        ImmutableSet.of(
            new QuotaConfiguration("steve", ResourceAggregates.none().newBuilder()));
    IHostAttributes attribute = IHostAttributes.build(
        new HostAttributes("host", ImmutableSet.of(new Attribute("attr", ImmutableSet.of("value"))))
View Full Code Here

  }

  @Test(expected = IllegalArgumentException.class)
  public void testInvalidInput() {
    TestFixture f = new TestFixture(NEW, 1);
    ScheduledTask noEvents = new TaskUtil(new FakeClock())
        .makeTask(OLD, RUNNING).newBuilder().setTaskEvents(ImmutableList.<TaskEvent>of());
    f.updater.evaluate(Optional.of(IScheduledTask.build(noEvents)));
  }
View Full Code Here

    void setActualStateAbsent() {
      this.task = Optional.absent();
    }

    private Result changeStatusAndEvaluate(ScheduleStatus status) {
      ScheduledTask builder = task.get().newBuilder();
      if (builder.getStatus() != status) {
        // Only add a task event if this is a state change.
        builder.addToTaskEvents(new TaskEvent().setTimestamp(clock.nowMillis()).setStatus(status));
      }
      builder.setStatus(status);

      task = Optional.of(IScheduledTask.build(builder));
      return updater.evaluate(task);
    }
View Full Code Here

        .setLocks(ImmutableSet.<Lock>of())
        .setJobUpdateDetails(ImmutableSet.<StoredJobUpdateDetails>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

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.