Examples of DeduplicatedSnapshot


Examples of org.apache.aurora.gen.storage.DeduplicatedSnapshot

        snapshotDeduplicator.reduplicate(snapshotDeduplicator.deduplicate(snapshot)));
  }

  @Test
  public void testDeduplicatedFormat() {
    DeduplicatedSnapshot deduplicatedSnapshot = snapshotDeduplicator.deduplicate(makeSnapshot());

    assertEquals(
        "The tasks field of the partial snapshot should be empty.",
        0,
        deduplicatedSnapshot.getPartialSnapshot().getTasksSize());

    assertEquals(
        "The total number of task configs should be equal to the number of unique task configs.",
        2,
        deduplicatedSnapshot.getTaskConfigsSize());

    assertEquals(
        ImmutableSet.of(makeConfig("a"), makeConfig("b")),
        ImmutableSet.copyOf(deduplicatedSnapshot.getTaskConfigs()));

    for (DeduplicatedScheduledTask task : deduplicatedSnapshot.getPartialTasks()) {
      assertEquals(
          "The deduplicated task should have the correct index into the taskConfigs table.",
          taskIdToConfig.get(task.getPartialScheduledTask().getAssignedTask().getTaskId()),
          deduplicatedSnapshot.getTaskConfigs().get(task.getTaskConfigId()));

      assertNull(
          "The task config field of partial scheduled tasks should be null.",
          task.getPartialScheduledTask().getAssignedTask().getTask());
    }
View Full Code Here

Examples of org.apache.aurora.gen.storage.DeduplicatedSnapshot

    }
  }

  @Test(expected = CodingException.class)
  public void testReduplicateFailure() throws Exception {
    DeduplicatedSnapshot corrupt = new DeduplicatedSnapshot()
        .setPartialSnapshot(new Snapshot().setSchedulerMetadata(new SchedulerMetadata()))
        .setPartialTasks(ImmutableList.of(
            new DeduplicatedScheduledTask()
                .setPartialScheduledTask(new ScheduledTask())
                .setTaskConfigId(1)))
View Full Code Here

Examples of org.apache.aurora.gen.storage.DeduplicatedSnapshot

      LOG.info(String.format("Starting deduplication of a snapshot with %d tasks.", numInputTasks));

      Snapshot partialSnapshot = snapshot.deepCopy();
      partialSnapshot.unsetTasks();

      DeduplicatedSnapshot deduplicatedSnapshot = new DeduplicatedSnapshot()
          .setPartialSnapshot(partialSnapshot);

      // Nothing to do if we don't have any input tasks.
      if (!snapshot.isSetTasks()) {
        LOG.warning("Got snapshot with unset tasks field.");
        return deduplicatedSnapshot;
      }

      // Match each unique TaskConfig to its hopefully-multiple ScheduledTask owners.
      ListMultimap<TaskConfig, ScheduledTask> index = Multimaps.index(
          snapshot.getTasks(),
          SCHEDULED_TO_CONFIG);

      for (Entry<TaskConfig, List<ScheduledTask>> entry : Multimaps.asMap(index).entrySet()) {
        deduplicatedSnapshot.addToTaskConfigs(entry.getKey());
        for (ScheduledTask scheduledTask : entry.getValue()) {
          deduplicatedSnapshot.addToPartialTasks(new DeduplicatedScheduledTask()
              .setPartialScheduledTask(deepCopyWithoutTaskConfig(scheduledTask))
              .setTaskConfigId(deduplicatedSnapshot.getTaskConfigsSize() - 1));
        }
      }

      int numOutputTasks = deduplicatedSnapshot.getTaskConfigsSize();

      LOG.info(String.format(
          "Finished deduplicating snapshot. Deduplication ratio: %d/%d = %.2f%%.",
          numInputTasks,
          numOutputTasks,
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.