third_party/blink/tools/blinkpy/web_tests/controllers/web_test_runner.py
def _shard_by_directory(self, test_inputs):
        """Returns two lists of shards, each shard containing all the files in a directory.

        This is the default mode, and gets as much parallelism as we can while
        minimizing flakiness caused by inter-test dependencies.
        """
        locked_shards = []
        unlocked_shards = []
        unlocked_slow_shards = []
        tests_by_dir = {}
        # FIXME: Given that the tests are already sorted by directory,
        # we can probably rewrite this to be clearer and faster.
        for test_input in test_inputs:
            directory = self._split(test_input.test_name)[0]
            tests_by_dir.setdefault(directory, [])
            tests_by_dir[directory].append(test_input)

        for directory, test_inputs in six.iteritems(tests_by_dir):
            shard = TestShard(directory, test_inputs)
            if test_inputs[0].requires_lock:
                locked_shards.append(shard)
            # In practice, virtual test suites are slow to run. It's a bit hacky, but
            # put them first since they're the long-tail of test runtime.
            elif directory.startswith('virtual'):
                unlocked_slow_shards.append(shard)
            else:
                unlocked_shards.append(shard)

        # Sort the shards by directory name.
        locked_shards.sort(key=lambda shard: shard.name)
        unlocked_slow_shards.sort(key=lambda shard: shard.name)
        unlocked_shards.sort(key=lambda shard: shard.name)

        # Put a ceiling on the number of locked shards, so that we
        # don't hammer the servers too badly.

        # FIXME: For now, limit to one shard or set it
        # with the --max-locked-shards. After testing to make sure we
        # can handle multiple shards, we should probably do something like
        # limit this to no more than a quarter of all workers, e.g.:
        # return max(math.ceil(num_workers / 4.0), 1)
        return (self._resize_shards(locked_shards, self._max_locked_shards,
                                    'locked_shard'),
                unlocked_slow_shards + unlocked_shards)
Returns two lists of shards, each shard containing all the files in a directory.

        This is the default mode, and gets as much parallelism as we can while
        minimizing flakiness caused by inter-test dependencies.
        
Returns two lists of shards, each shard containing all the files in a directory.
This is the default mode, and gets as much parallelism as we can while
minimizing flakiness caused by inter-test dependencies.
Returns two lists of shards each shard containing all the files in a directory . This is the default mode and gets as much parallelism as we can while minimizing flakiness caused by inter - test dependencies .
def _shard_by_directory(self, test_inputs):
        locked_shards = []
        unlocked_shards = []
        unlocked_slow_shards = []
        tests_by_dir = {}
        for test_input in test_inputs:
            directory = self._split(test_input.test_name)[0]
            tests_by_dir.setdefault(directory, [])
            tests_by_dir[directory].append(test_input)
        for directory, test_inputs in six.iteritems(tests_by_dir):
            shard = TestShard(directory, test_inputs)
            if test_inputs[0].requires_lock:
                locked_shards.append(shard)
            elif directory.startswith('virtual'):
                unlocked_slow_shards.append(shard)
            else:
                unlocked_shards.append(shard)
        locked_shards.sort(key=lambda shard: shard.name)
        unlocked_slow_shards.sort(key=lambda shard: shard.name)
        unlocked_shards.sort(key=lambda shard: shard.name)
        return (self._resize_shards(locked_shards, self._max_locked_shards,
                                    'locked_shard'),
                unlocked_slow_shards + unlocked_shards)
def _shard_by_directory ( self , test_inputs ) : locked_shards = [ ] unlocked_shards = [ ] unlocked_slow_shards = [ ] tests_by_dir = { } for test_input in test_inputs : directory = self . _split ( test_input . test_name ) [ 0 ] tests_by_dir . setdefault ( directory , [ ] ) tests_by_dir [ directory ] . append ( test_input ) for directory , test_inputs in six . iteritems ( tests_by_dir ) : shard = TestShard ( directory , test_inputs ) if test_inputs [ 0 ] . requires_lock : locked_shards . append ( shard ) elif directory . startswith ( 'virtual' ) : unlocked_slow_shards . append ( shard ) else : unlocked_shards . append ( shard ) locked_shards . sort ( key = lambda shard : shard . name ) unlocked_slow_shards . sort ( key = lambda shard : shard . name ) unlocked_shards . sort ( key = lambda shard : shard . name ) return ( self . _resize_shards ( locked_shards , self . _max_locked_shards , 'locked_shard' ) , unlocked_slow_shards + unlocked_shards )
Returns two lists of shards, each shard containing all the files in a directory.
Returns two lists of shards each shard containing all the files in a directory .
"""Returns two lists of shards, each shard containing all the files in a directory.

        This is the default mode, and gets as much parallelism as we can while
        minimizing flakiness caused by inter-test dependencies.
        """ # FIXME: Given that the tests are already sorted by directory, # we can probably rewrite this to be clearer and faster. # In practice, virtual test suites are slow to run. It's a bit hacky, but # put them first since they're the long-tail of test runtime. # Sort the shards by directory name. # Put a ceiling on the number of locked shards, so that we # don't hammer the servers too badly. # FIXME: For now, limit to one shard or set it # with the --max-locked-shards. After testing to make sure we # can handle multiple shards, we should probably do something like # limit this to no more than a quarter of all workers, e.g.: # return max(math.ceil(num_workers / 4.0), 1)
self
test_inputs