Claude
commited on
feat(api): add ephemeral storage warning to results (BUG-005)
Browse files- Add warning field to SegmentResponse schema
- Include warning message in job completion result:
"Results are temporary and will be lost if Space restarts"
- Update frontend types to include warning in Metrics
- Display yellow warning banner in MetricsPanel when present
frontend/src/components/MetricsPanel.tsx
CHANGED
|
@@ -40,6 +40,13 @@ export function MetricsPanel({ metrics }: MetricsPanelProps) {
|
|
| 40 |
</span>
|
| 41 |
</div>
|
| 42 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
</div>
|
| 44 |
)
|
| 45 |
}
|
|
|
|
| 40 |
</span>
|
| 41 |
</div>
|
| 42 |
</div>
|
| 43 |
+
|
| 44 |
+
{/* Ephemeral storage warning */}
|
| 45 |
+
{metrics.warning && (
|
| 46 |
+
<div className="mt-3 p-2 bg-yellow-900/30 border border-yellow-600/50 rounded text-xs text-yellow-300">
|
| 47 |
+
{metrics.warning}
|
| 48 |
+
</div>
|
| 49 |
+
)}
|
| 50 |
</div>
|
| 51 |
)
|
| 52 |
}
|
src/stroke_deepisles_demo/api/routes.py
CHANGED
|
@@ -244,6 +244,7 @@ def run_segmentation_job(
|
|
| 244 |
"elapsedSeconds": round(result.elapsed_seconds, 2),
|
| 245 |
"dwiUrl": f"{backend_url}{file_path_prefix}/{dwi_filename}",
|
| 246 |
"predictionUrl": f"{backend_url}{file_path_prefix}/{pred_filename}",
|
|
|
|
| 247 |
}
|
| 248 |
|
| 249 |
# Mark as completed
|
|
|
|
| 244 |
"elapsedSeconds": round(result.elapsed_seconds, 2),
|
| 245 |
"dwiUrl": f"{backend_url}{file_path_prefix}/{dwi_filename}",
|
| 246 |
"predictionUrl": f"{backend_url}{file_path_prefix}/{pred_filename}",
|
| 247 |
+
"warning": "Results are temporary and will be lost if the Space restarts. Download promptly.",
|
| 248 |
}
|
| 249 |
|
| 250 |
# Mark as completed
|
src/stroke_deepisles_demo/api/schemas.py
CHANGED
|
@@ -27,6 +27,9 @@ class SegmentResponse(BaseModel):
|
|
| 27 |
elapsedSeconds: float
|
| 28 |
dwiUrl: str
|
| 29 |
predictionUrl: str
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
|
| 32 |
# Job status type for strong typing
|
|
|
|
| 27 |
elapsedSeconds: float
|
| 28 |
dwiUrl: str
|
| 29 |
predictionUrl: str
|
| 30 |
+
warning: str | None = Field(
|
| 31 |
+
None, description="Warning message about result storage (e.g., ephemeral disk)"
|
| 32 |
+
)
|
| 33 |
|
| 34 |
|
| 35 |
# Job status type for strong typing
|