Skip to content

Commit f07c1ec

Browse files
committed
[diffusion] CI: add testcase-wise retry mechanism
1 parent 407cb3c commit f07c1ec

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

python/sglang/multimodal_gen/test/run_suite.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,27 @@ def run_pytest(files):
6767
print("No files to run.")
6868
return 0
6969

70-
cmd = [sys.executable, "-m", "pytest", "-s", "-v", "--log-cli-level=INFO"] + files
70+
base_cmd = [sys.executable, "-m", "pytest", "-s", "-v", "--log-cli-level=INFO"]
71+
72+
# Retry up to 2 times on failure
73+
max_retries = 2
74+
for i in range(max_retries + 1):
75+
cmd = list(base_cmd)
76+
77+
if i > 0:
78+
cmd.append("--last-failed")
79+
logger.info(
80+
f"Test run failed. Retrying ({i}/{max_retries}) with --last-failed..."
81+
)
82+
83+
cmd.extend(files)
84+
85+
logger.info(f"Running command: {' '.join(cmd)}")
86+
result = subprocess.run(cmd)
87+
88+
if result.returncode == 0:
89+
return 0
7190

72-
logger.info(f"Running command: {' '.join(cmd)}")
73-
result = subprocess.run(cmd)
7491
return result.returncode
7592

7693

0 commit comments

Comments
 (0)