Examples of IJobKey


Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

  @Override
  public void updateJob(final SanitizedCronJob config) throws CronException {
    requireNonNull(config);
    checkNoRunOverlap(config);

    final IJobKey jobKey = config.getSanitizedConfig().getJobConfig().getKey();
    storage.write(new MutateWork.NoResult<CronException>() {
      @Override
      public void execute(Storage.MutableStoreProvider storeProvider) throws CronException {
        checkCronExists(jobKey, storeProvider.getJobStore());
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

  @Override
  public void createJob(final SanitizedCronJob cronJob) throws CronException {
    requireNonNull(cronJob);
    checkNoRunOverlap(cronJob);

    final IJobKey jobKey = cronJob.getSanitizedConfig().getJobConfig().getKey();
    storage.write(new MutateWork.NoResult<CronException>() {
      @Override
      protected void execute(Storage.MutableStoreProvider storeProvider) throws CronException {
        checkNotExists(jobKey, storeProvider.getJobStore());
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

            return null;
          }
        }
    );

    IJobKey jobKey = Iterables.getOnlyElement(
        FluentIterable.from(tasksInJob).transform(Tasks.SCHEDULED_TO_JOB_KEY).toSet());
    storageUtil.expectTaskFetch(HistoryPruner.jobHistoryQuery(jobKey), tasksInJob);
    if (pruned.length > 0) {
      stateManager.deleteTasks(Tasks.ids(pruned));
    }
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

  }

  @Test
  public void testServiceTasksRescheduled() throws Exception {
    int numServiceTasks = 5;
    IJobKey adhocKey = KEY_A;
    IJobKey serviceKey = IJobKey.build(
        adhocKey.newBuilder().setName(adhocKey.getName() + "service"));

    expectTaskNotThrottled().times(numServiceTasks);
    expectNoCronJob(adhocKey);
    expectNoCronJob(serviceKey);
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

    lockManager.validateIfLocked(LOCK_KEY, Optional.<ILock>absent());
  }

  @Test
  public void testValidateLockNotStoredHeld() throws Exception {
    IJobKey jobKey = JobKeys.from("r", "e", "n");
    expectLockException(jobKey);
    ILock lock = lockManager.acquireLock(LOCK_KEY, USER);
    ILockKey key = ILockKey.build(LockKey.job(jobKey.newBuilder()));
    lockManager.validateIfLocked(key, Optional.of(lock));
  }
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

  @Override
  public void saveAcceptedJob(String managerId, IJobConfiguration jobConfig) {
    requireNonNull(managerId);
    requireNonNull(jobConfig);

    IJobKey key = JobKeys.assertValid(jobConfig.getKey());
    managers.getUnchecked(managerId).jobs.put(key, jobConfig);
  }
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

    }.run();
  }

  @Test
  public void testRemoveJob() throws Exception {
    final IJobKey jobKey = JobKeys.from("role", "env", "name");
    new MutationFixture() {
      @Override
      protected void setupExpectations() throws Exception {
        storageUtil.expectWriteOperation();
        storageUtil.jobStore.removeJob(jobKey);
        streamMatcher.expectTransaction(
            Op.removeJob(new RemoveJob().setJobKey(jobKey.newBuilder())))
            .andReturn(position);
      }

      @Override
      protected void performMutations(MutableStoreProvider storeProvider) {
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

    assertResponse(INVALID_REQUEST, thrift.getPendingReason(query.get()));
  }

  @Test
  public void testGetConfigSummary() throws Exception {
    IJobKey key = JobKeys.from("test", "test", "test");

    TaskConfig firstGroupTask = defaultTask(true);
    TaskConfig secondGroupTask = defaultTask(true).setNumCpus(2);

    IScheduledTask first1 = IScheduledTask.build(new ScheduledTask()
        .setAssignedTask(new AssignedTask().setTask(firstGroupTask).setInstanceId(0)));

    IScheduledTask first2 = IScheduledTask.build(new ScheduledTask()
        .setAssignedTask(new AssignedTask().setTask(firstGroupTask).setInstanceId(1)));

    IScheduledTask second = IScheduledTask.build(new ScheduledTask()
        .setAssignedTask(new AssignedTask().setTask(secondGroupTask).setInstanceId(2)));

    storageUtil.expectTaskFetch(Query.jobScoped(key).active(), first1, first2, second);

    ConfigGroup group1 = new ConfigGroup()
        .setConfig(firstGroupTask)
        .setInstanceIds(Sets.newHashSet(0, 1));
    ConfigGroup group2 = new ConfigGroup()
        .setConfig(secondGroupTask)
        .setInstanceIds(Sets.newHashSet(2));

    ConfigSummary summary = new ConfigSummary()
        .setKey(key.newBuilder())
        .setGroups(Sets.newHashSet(group1, group2));

    ConfigSummaryResult expected = new ConfigSummaryResult().setSummary(summary);

    control.replay();

    Response response = assertOkResponse(thrift.getConfigSummary(key.newBuilder()));
    assertEquals(expected, response.getResult().getConfigSummaryResult());
  }
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

    assertEquals(expected, response.getResult().getConfigSummaryResult());
  }

  @Test
  public void testEmptyConfigSummary() throws Exception {
    IJobKey key = JobKeys.from("test", "test", "test");

    storageUtil.expectTaskFetch(Query.jobScoped(key).active(), ImmutableSet.<IScheduledTask>of());

    ConfigSummary summary = new ConfigSummary()
        .setKey(key.newBuilder())
        .setGroups(Sets.<ConfigGroup>newHashSet());

    ConfigSummaryResult expected = new ConfigSummaryResult().setSummary(summary);

    control.replay();

    Response response = assertOkResponse(thrift.getConfigSummary(key.newBuilder()));
    assertEquals(expected, response.getResult().getConfigSummaryResult());
  }
View Full Code Here

Examples of org.apache.aurora.scheduler.storage.entities.IJobKey

  public Response dump(
      @PathParam("role") final String role,
      @PathParam("environment") final String environment,
      @PathParam("job") final String job) {

    final IJobKey jobKey = JobKeys.from(role, environment, job);
    return dumpEntity("Cron job " + JobKeys.canonicalString(jobKey),
        new Work.Quiet<Optional<? extends TBase<?, ?>>>() {
          @Override
          public Optional<JobConfiguration> apply(StoreProvider storeProvider) {
            return storeProvider.getJobStore().fetchJob(cronJobManager.getManagerKey(), jobKey)
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.