[CI] Parallelize unit tests in CI (#1219)

This commit is contained in:
Mingyi
2024-08-25 21:54:02 -07:00
committed by GitHub
parent 632d506d0b
commit 97589a60a2
6 changed files with 99 additions and 75 deletions

View File

@@ -1,6 +1,5 @@
import argparse
import glob
import multiprocessing as mp
from sglang.test.test_utils import run_unittest_files
@@ -49,6 +48,18 @@ if __name__ == "__main__":
choices=list(suites.keys()) + ["all"],
help="The suite to run",
)
arg_parser.add_argument(
"--range-begin",
type=int,
default=0,
help="The begin index of the range of the files to run.",
)
arg_parser.add_argument(
"--range-end",
type=int,
default=None,
help="The end index of the range of the files to run.",
)
args = arg_parser.parse_args()
if args.suite == "all":
@@ -56,5 +67,7 @@ if __name__ == "__main__":
else:
files = suites[args.suite]
files = files[args.range_begin : args.range_end]
exit_code = run_unittest_files(files, args.timeout_per_file)
exit(exit_code)