[CI] Batch CPU test workers (#37252)
This commit is contained in:
@@ -158,7 +158,7 @@ jobs:
|
||||
SGLANG_SKIP_RUST_TESTS: ${{ fromJson(inputs.check_changes).rust_workspace == 'true' && 'false' || 'true' }}
|
||||
run: |
|
||||
cd test/
|
||||
python3 run_suite.py --hw cpu --suite ${{ inputs.self_name }} --auto-partition-id ${{ matrix.partition }} --auto-partition-size ${{ fromJson(inputs.partitions)[inputs.self_name].size }} --partition-model-file /tmp/partition-model.json $CONTINUE_ON_ERROR_FLAG
|
||||
python3 run_suite.py --hw cpu --suite ${{ inputs.self_name }} --auto-partition-id ${{ matrix.partition }} --auto-partition-size ${{ fromJson(inputs.partitions)[inputs.self_name].size }} --partition-model-file /tmp/partition-model.json --fork-worker-batch-size 20 $CONTINUE_ON_ERROR_FLAG
|
||||
|
||||
# PRs save only what the base lacks; the implicit if: success() keeps a
|
||||
# half-downloaded cache unpublished.
|
||||
|
||||
@@ -33,6 +33,10 @@ def _normalize_exit_code(code) -> int:
|
||||
|
||||
def _run_file(filename: str) -> int:
|
||||
sys.argv = [filename, "-f"]
|
||||
# Match ``python /path/to/test.py``: tests may import helper modules that
|
||||
# live next to the executed file. runpy.run_path() does not update
|
||||
# sys.path[0] for us, and this child exits after the file finishes.
|
||||
sys.path[0] = os.path.dirname(os.path.abspath(filename))
|
||||
try:
|
||||
runpy.run_path(filename, run_name="__main__")
|
||||
return 0
|
||||
|
||||
@@ -54,14 +54,28 @@ class TestForkTestWorker(CustomTestCase):
|
||||
assert "SGLANG_FORK_WORKER_TEST" not in os.environ
|
||||
raise SystemExit(3)
|
||||
"""))
|
||||
helper = Path(tmpdir) / "sibling_helper.py"
|
||||
helper.write_text("VALUE = 42\n")
|
||||
sibling_import = Path(tmpdir) / "sibling_import.py"
|
||||
sibling_import.write_text(textwrap.dedent("""
|
||||
import os
|
||||
import sys
|
||||
|
||||
from sibling_helper import VALUE
|
||||
|
||||
assert sys.path[0] == os.path.dirname(__file__)
|
||||
assert VALUE == 42
|
||||
"""))
|
||||
|
||||
results = []
|
||||
for filename in (first, second):
|
||||
for filename in (first, second, sibling_import):
|
||||
process.stdin.write(json.dumps({"filename": str(filename)}) + "\n")
|
||||
process.stdin.flush()
|
||||
results.append(json.loads(result_stream.readline()))
|
||||
|
||||
self.assertEqual([result["returncode"] for result in results], [0, 3])
|
||||
self.assertEqual(
|
||||
[result["returncode"] for result in results], [0, 3, 0]
|
||||
)
|
||||
self.assertTrue(all(result["elapsed"] >= 0 for result in results))
|
||||
|
||||
process.stdin.write(json.dumps({"command": "stop"}) + "\n")
|
||||
|
||||
Reference in New Issue
Block a user