Spaces:
Sleeping
Sleeping
Commit ·
184da50
1
Parent(s): 5ded4bf
Fix: add missing /, /health, /tasks, /openenv/state endpoints
Browse files
app.py
CHANGED
|
@@ -43,6 +43,60 @@ async def reset(req: ResetRequest):
|
|
| 43 |
return _http_env.reset(seed=req.seed)
|
| 44 |
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
@app.post("/step", response_model=StepResponse)
|
| 47 |
async def step(action: Optional[MLOpsAction] = None, data: Optional[dict] = None):
|
| 48 |
if _http_env is None:
|
|
|
|
| 43 |
return _http_env.reset(seed=req.seed)
|
| 44 |
|
| 45 |
|
| 46 |
+
@app.get("/")
|
| 47 |
+
async def root():
|
| 48 |
+
return {
|
| 49 |
+
"message": "MLOps Pipeline Debugger API",
|
| 50 |
+
"version": "1.0.0",
|
| 51 |
+
"docs": "This is an OpenEnv-compatible RL environment",
|
| 52 |
+
"endpoints": {
|
| 53 |
+
"GET /": "This message",
|
| 54 |
+
"GET /health": "Health check",
|
| 55 |
+
"GET /tasks": "List available tasks",
|
| 56 |
+
"GET /openenv/state": "OpenEnv state",
|
| 57 |
+
"POST /reset": "Start a new episode",
|
| 58 |
+
"POST /step": "Take an action",
|
| 59 |
+
"GET /state": "Get current state",
|
| 60 |
+
},
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
@app.get("/health")
|
| 65 |
+
async def health():
|
| 66 |
+
return {"status": "ok", "environment": "mlops_debug_env", "version": "1.0.0"}
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
@app.get("/openenv/state", response_model=OpenEnvState)
|
| 70 |
+
def openenv_state():
|
| 71 |
+
return OPENENV_STATE
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
@app.get("/tasks")
|
| 75 |
+
async def list_tasks():
|
| 76 |
+
return {
|
| 77 |
+
"tasks": [
|
| 78 |
+
{
|
| 79 |
+
"task_id": "easy",
|
| 80 |
+
"name": "Config Error Diagnosis",
|
| 81 |
+
"difficulty": "easy",
|
| 82 |
+
"max_steps": 20,
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"task_id": "medium",
|
| 86 |
+
"name": "Data Leakage Detection",
|
| 87 |
+
"difficulty": "medium",
|
| 88 |
+
"max_steps": 30,
|
| 89 |
+
},
|
| 90 |
+
{
|
| 91 |
+
"task_id": "hard",
|
| 92 |
+
"name": "Silent Evaluation Bug",
|
| 93 |
+
"difficulty": "hard",
|
| 94 |
+
"max_steps": 40,
|
| 95 |
+
},
|
| 96 |
+
]
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
|
| 100 |
@app.post("/step", response_model=StepResponse)
|
| 101 |
async def step(action: Optional[MLOpsAction] = None, data: Optional[dict] = None):
|
| 102 |
if _http_env is None:
|