-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.py
More file actions
29 lines (23 loc) · 837 Bytes
/
Copy pathapi.py
File metadata and controls
29 lines (23 loc) · 837 Bytes
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
27
28
29
import subprocess
from fastapi import FastAPI, HTTPException
from fastapi.responses import PlainTextResponse
app = FastAPI(title="Linum Core API", version="1.0.0")
@app.get("/health")
def health_check():
return {"status": "healthy"}
@app.post("/v1/benchmark/spsc")
def run_spsc_benchmark():
try:
# Execute the compiled Stage D binary directly
result = subprocess.run(
["./linum_stage_d_exec"],
capture_output=True,
text=True,
timeout=10,
cwd="/home/ron/linum"
)
if result.returncode != 0:
raise HTTPException(status_code=500, detail=result.stderr)
return PlainTextResponse(content=result.stdout)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))