Run RTMLib benchmark outside production startup
This commit is contained in:
@@ -18,7 +18,7 @@ def percentile(values: list[float], p: float) -> float:
|
||||
|
||||
|
||||
def run_offline_benchmark(models, threshold: float, max_people: int) -> None:
|
||||
path = "/logs/offline-benchmark-" + os.getenv("BENCHMARK_PROFILE", "unknown") + ".json"
|
||||
path = os.getenv("BENCHMARK_OUTPUT", "/logs/offline-benchmark-" + os.getenv("BENCHMARK_PROFILE", "unknown") + ".json")
|
||||
if os.path.exists(path):
|
||||
return
|
||||
try:
|
||||
@@ -48,9 +48,12 @@ def run_offline_benchmark(models, threshold: float, max_people: int) -> None:
|
||||
"p95_ms": round(percentile(vals, .95), 3),
|
||||
"p99_ms": round(percentile(vals, .99), 3)}
|
||||
for name, vals in stages.items()}}
|
||||
with open(path, "x", encoding="utf-8") as fh:
|
||||
json.dump(report, fh, indent=2)
|
||||
with open(path, "w", encoding="utf-8") as fh:
|
||||
json.dump(report, fh, indent=2)
|
||||
print(f"benchmark profile people={requested} complete", flush=True)
|
||||
os.chmod(path, 0o666)
|
||||
except Exception as exc:
|
||||
with open(path, "w", encoding="utf-8") as fh:
|
||||
json.dump({"error": f"{type(exc).__name__}: {str(exc)[:240]}", "source_url": DEMO_URL,
|
||||
"image_retained": False}, fh, indent=2)
|
||||
os.chmod(path, 0o666)
|
||||
|
||||
Reference in New Issue
Block a user