File size: 1,143 Bytes
487088f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""GPU track (run on the A10G box with SD_GPU=1): reproduce famous GPU Spaces broken by code drift, then treat them.
A10G is the GPU of HF's a10g-small; t4/l4 Spaces are verified on it too (noted per case)."""
import json, os, sys, concurrent.futures as cf

IDS, sys.argv = sys.argv[1:], sys.argv[:1]  # reproduce.py reads sys.argv at import
import reproduce, doctor, beam
census = {r["id"]: r for r in reproduce.CENSUS}

def go(sid):
    d = reproduce.OUT / sid.replace("/", "__")
    try:
        if not (d / "repro.json").exists():
            reproduce.run(census[sid])
        rec = json.load(open(d / "repro.json"))
        if rec["our_stage"] not in ("runtime_error", "build_error"):
            print(f"{sid}: not broken in our rebuild ({rec['our_stage']}), skipped", flush=True); return
        if not (d / "case.json").exists():
            doctor.treat(d)
    except beam.BudgetExhausted as e:
        print(f"{sid}: BUDGET STOP {e}", flush=True)
    except Exception as e:
        print(f"{sid}: harness error {e!r}", flush=True)

with cf.ThreadPoolExecutor(int(os.environ.get("SD_WORKERS", "2"))) as ex:
    list(ex.map(go, IDS))