Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/testing/mozharness/mozharness/base/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  parallel.py   Sprache: Python

 
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
"""Generic ways to parallelize jobs.
"""


# ChunkingMixin {{{1
class ChunkingMixin(object):
    """Generic Chunking helper methods."""

    def query_chunked_list(self, possible_list, this_chunk, total_chunks, sort=False):
        """Split a list of items into a certain number of chunks and
        return the subset of that will occur in this chunk.

        Ported from build.l10n.getLocalesForChunk in build/tools.
        """
        if sort:
            possible_list = sorted(possible_list)
        else:
            # Copy to prevent altering
            possible_list = possible_list[:]
        length = len(possible_list)
        for c in range(1, total_chunks + 1):
            n = length // total_chunks
            # If the total number of items isn't evenly divisible by the
            # number of chunks, we need to append one more onto some chunks
            if c <= (length % total_chunks):
                n += 1
            if c == this_chunk:
                return possible_list[0:n]
            del possible_list[0:n]

Messung V0.5
C=93 H=95 G=93

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.