Skip to content

Minecraft: Java Edition 26.3 rewritten from scratch in Rust, checked against vanilla with 281 differential harnesses. Get it with the Horizon launcher.

779 B
Raw Blame
"""A sharded harness's share of its cases.

A harness that declares PARITY_SHARDS = n runs as n entries in tools/parity.py, which sets PARITY_SHARD=i/n for
each. Outside the runner PARITY_SHARD is unset and a harness runs everything. Kept out of lab.py: every harness
imports lab.py, so a change there reruns them all.
"""
import os


def shard(items):
    """Every n-th item from the i-th, or all of them outside the runner."""
    spec = os.environ.get("PARITY_SHARD")
    if not spec:
        return items
    index, count = map(int, spec.split("/"))
    return items[index - 1::count]


def label():
    """A directory name for this share ("2-4", or "all"): shards run at once and must not share outputs."""
    return os.environ.get("PARITY_SHARD", "all").replace("/", "-")