Ejemplo n.º 1
0
    def RunSetStories(self):
        possible_stories = [
            s for s in system_health_stories.IterAllSystemHealthStoryClasses()
            if (s.NAME not in self._BLACKLIST and not s.ABSTRACT_STORY
                and self._PLATFORM in s.SUPPORTED_PLATFORMS)
        ]
        assert (self._num_training + self._num_variations * self._num_testing
                <= len(possible_stories)), \
            'We only have {} stories to work with, but want {} + {}*{}'.format(
                len(possible_stories), self._num_training, self._num_variations,
                self._num_testing)

        if self._run_set == self.DEBUGGING:
            return random.sample(possible_stories, 3)

        random.shuffle(possible_stories)
        if self._run_set == self.TRAINING:
            return possible_stories[:self._num_training]
        elif self._run_set == self.TESTING:
            return possible_stories[(
                self._num_training +
                self._test_variation * self._num_testing):(
                    self._num_training +
                    (self._test_variation + 1) * self._num_testing)]
        assert False, 'Bad run set {}'.format(self._run_set)
Ejemplo n.º 2
0
        def __init__(self, platform, take_memory_measurement=True):
            super(OrderfileMemory.OrderfileMemoryStorySet,
                  self).__init__(archive_data_file=(
                      '../../page_sets/data/system_health_%s.json' % platform),
                                 cloud_storage_bucket=story.PARTNER_BUCKET)

            assert platform in platforms.ALL_PLATFORMS
            for story_class in system_health_stories.IterAllSystemHealthStoryClasses(
            ):
                if (story_class.ABSTRACT_STORY
                        or platform not in story_class.SUPPORTED_PLATFORMS
                        or story_class.NAME not in self._STORY_SET):
                    continue
                self.AddStory(story_class(self, take_memory_measurement))