Package org.apache.aurora.gen

Examples of org.apache.aurora.gen.ScheduledTask


        Query.Builder query = Query.taskScoped(taskId);
        storeProvider.getUnsafeTaskStore().mutateTasks(query,
            new Function<IScheduledTask, IScheduledTask>() {
              @Override
              public IScheduledTask apply(IScheduledTask task) {
                ScheduledTask builder = task.newBuilder();
                AssignedTask assigned = builder.getAssignedTask();
                assigned.setAssignedPorts(
                    getNameMappedPorts(assigned.getTask().getRequestedPorts(), assignedPorts));
                assigned.setSlaveHost(slaveHost)
                    .setSlaveId(slaveId.getValue());
                return IScheduledTask.build(builder);
View Full Code Here


                  "Operation expected task " + taskId + " to be present.");

              storeProvider.getUnsafeTaskStore().mutateTasks(query, new TaskMutation() {
                @Override
                public IScheduledTask apply(IScheduledTask task) {
                  ScheduledTask mutableTask = task.newBuilder();
                  mutableTask.setStatus(targetState.get());
                  mutableTask.addToTaskEvents(new TaskEvent()
                      .setTimestamp(clock.nowMillis())
                      .setStatus(targetState.get())
                      .setMessage(transitionMessage.orNull())
                      .setScheduler(LOCAL_HOST_SUPPLIER.get()));
                  return IScheduledTask.build(mutableTask);
View Full Code Here

      task.addToConstraints(new Constraint(
          ConfigurationManager.DEDICATED_ATTRIBUTE,
          TaskConstraint.value(new ValueConstraint(false, ImmutableSet.of(dedicated.get())))));
    }

    return IScheduledTask.build(new ScheduledTask()
        .setStatus(status)
        .setAssignedTask(
            new AssignedTask()
                .setTaskId(id)
                .setTask(task)));
View Full Code Here

    // Query calls work against upgraded MemTaskStore, which does not support deprecated fields.
    LOG.info("Backfilling task config job keys.");
    storeProvider.getUnsafeTaskStore().mutateTasks(Query.unscoped(), new TaskMutation() {
      @Override
      public IScheduledTask apply(final IScheduledTask task) {
        ScheduledTask builder = task.newBuilder();
        populateJobKey(builder.getAssignedTask().getTask(), BACKFILLED_TASK_CONFIG_KEYS);
        return IScheduledTask.build(builder);
      }
    });

    LOG.info("Performing shard uniqueness sanity check.");
    storeProvider.getUnsafeTaskStore().mutateTasks(Query.unscoped(), new TaskMutation() {
      @Override
      public IScheduledTask apply(final IScheduledTask task) {
        ScheduledTask builder = task.newBuilder();
        ConfigurationManager.applyDefaultsIfUnset(builder.getAssignedTask().getTask());
        // TODO(ksweeney): Guarantee tasks pass current validation code here and quarantine if they
        // don't.
        guaranteeShardUniqueness(builder, storeProvider.getUnsafeTaskStore(), clock);
        rewriteSandboxDeletedState(builder);
        return IScheduledTask.build(builder);
View Full Code Here

  private IScheduledTask createTask(int instanceId, ITaskConfig template) {
    AssignedTask assigned = new AssignedTask()
        .setTaskId(taskIdGenerator.generate(template, instanceId))
        .setInstanceId(instanceId)
        .setTask(template.newBuilder());
    return IScheduledTask.build(new ScheduledTask()
        .setStatus(INIT)
        .setAssignedTask(assigned));
  }
View Full Code Here

    Query.Builder query = Query.taskScoped(taskId);
    storeProvider.getUnsafeTaskStore().mutateTasks(query,
        new Function<IScheduledTask, IScheduledTask>() {
          @Override
          public IScheduledTask apply(IScheduledTask task) {
            ScheduledTask builder = task.newBuilder();
            AssignedTask assigned = builder.getAssignedTask();
            assigned.setAssignedPorts(
                getNameMappedPorts(assigned.getTask().getRequestedPorts(), assignedPorts));
            assigned.setSlaveHost(slaveHost)
                .setSlaveId(slaveId.getValue());
            return IScheduledTask.build(builder);
View Full Code Here

              "Operation expected task " + taskId + " to be present.");

          taskStore.mutateTasks(query, new TaskMutation() {
            @Override
            public IScheduledTask apply(IScheduledTask task) {
              ScheduledTask mutableTask = task.newBuilder();
              mutableTask.setStatus(targetState.get());
              mutableTask.addToTaskEvents(new TaskEvent()
                  .setTimestamp(clock.nowMillis())
                  .setStatus(targetState.get())
                  .setMessage(transitionMessage.orNull())
                  .setScheduler(LOCAL_HOST_SUPPLIER.get()));
              return IScheduledTask.build(mutableTask);
View Full Code Here

    }
    vars.startAsync().awaitRunning();
  }

  private IScheduledTask makeTask(String job, ScheduleStatus status, String host) {
    ScheduledTask task = new ScheduledTask()
        .setStatus(status)
        .setAssignedTask(new AssignedTask()
            .setTaskId(TASK_ID)
            .setTask(new TaskConfig()
                .setJob(new JobKey(ROLE_A, ENV, job))
                .setJobName(job)
                .setEnvironment(ENV)
                .setOwner(new Identity(ROLE_A, ROLE_A + "-user"))));
    if (Tasks.SLAVE_ASSIGNED_STATES.contains(status) || Tasks.isTerminated(status)) {
      task.getAssignedTask().setSlaveHost(host);
    }

    return IScheduledTask.build(task);
  }
View Full Code Here

          }
        });
  }

  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()
                .setJob(new JobKey("role-" + id, "test", "job-" + id))
                .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

        eq(SETTINGS.getCredentials()),
        eq(SETTINGS.getFrameworkInfo()),
        eq(SETTINGS.getMasterUri())))
        .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

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.