@mytec: iter3.7.0 start, gpu calc int
This commit is contained in:
@@ -14,6 +14,7 @@ from app.services.coverage_service import (
|
||||
select_propagation_model,
|
||||
)
|
||||
from app.services.parallel_coverage_service import CancellationToken
|
||||
from app.services.boundary_service import calculate_coverage_boundary
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -24,6 +25,12 @@ class CoverageRequest(BaseModel):
|
||||
settings: CoverageSettings = CoverageSettings()
|
||||
|
||||
|
||||
class BoundaryPoint(BaseModel):
|
||||
"""Single boundary coordinate"""
|
||||
lat: float
|
||||
lon: float
|
||||
|
||||
|
||||
class CoverageResponse(BaseModel):
|
||||
"""Coverage calculation response"""
|
||||
points: List[CoveragePoint]
|
||||
@@ -32,6 +39,7 @@ class CoverageResponse(BaseModel):
|
||||
stats: dict
|
||||
computation_time: float # seconds
|
||||
models_used: List[str] # which models were active
|
||||
boundary: Optional[List[BoundaryPoint]] = None # coverage boundary polygon
|
||||
|
||||
|
||||
@router.post("/calculate")
|
||||
@@ -131,13 +139,24 @@ async def calculate_coverage(request: CoverageRequest) -> CoverageResponse:
|
||||
"points_with_atmospheric_loss": sum(1 for p in points if p.atmospheric_loss > 0),
|
||||
}
|
||||
|
||||
# Calculate coverage boundary
|
||||
boundary = None
|
||||
if points:
|
||||
boundary_coords = calculate_coverage_boundary(
|
||||
[p.model_dump() for p in points],
|
||||
threshold_dbm=request.settings.min_signal,
|
||||
)
|
||||
if boundary_coords:
|
||||
boundary = [BoundaryPoint(**c) for c in boundary_coords]
|
||||
|
||||
return CoverageResponse(
|
||||
points=points,
|
||||
count=len(points),
|
||||
settings=effective_settings,
|
||||
stats=stats,
|
||||
computation_time=round(computation_time, 2),
|
||||
models_used=models_used
|
||||
models_used=models_used,
|
||||
boundary=boundary,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,29 @@
|
||||
import sys
|
||||
import platform
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
from app.api.deps import get_db
|
||||
from app.services.gpu_backend import gpu_manager
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/")
|
||||
async def health_check():
|
||||
return {"status": "ok", "service": "rfcp-backend", "version": "1.1.0"}
|
||||
gpu_info = gpu_manager.get_status()
|
||||
return {
|
||||
"status": "ok",
|
||||
"service": "rfcp-backend",
|
||||
"version": "3.6.0",
|
||||
"build": "gpu" if gpu_info.get("gpu_available") else "cpu",
|
||||
"gpu": {
|
||||
"available": gpu_info.get("gpu_available", False),
|
||||
"backend": gpu_info.get("active_backend", "cpu"),
|
||||
"device": gpu_info.get("active_device", {}).get("name") if gpu_info.get("active_device") else "CPU",
|
||||
},
|
||||
"python": sys.version.split()[0],
|
||||
"platform": platform.system(),
|
||||
}
|
||||
|
||||
|
||||
@router.get("/db")
|
||||
|
||||
Reference in New Issue
Block a user