docs: update production workflow design and runtime changes

This commit is contained in:
2026-06-14 18:47:00 +08:00
parent 58a87706ef
commit b1c59051b9
41 changed files with 2042 additions and 134 deletions
+5 -1
View File
@@ -260,4 +260,8 @@ async def get_dinsar_product_preview(
if not preview_path or not os.path.isfile(preview_path):
raise HTTPException(status_code=404, detail="Preview not found")
media_type = mimetypes.guess_type(preview_path)[0] or "application/octet-stream"
return FileResponse(preview_path, media_type=media_type)
return FileResponse(
preview_path,
media_type=media_type,
headers={"Cache-Control": "public, max-age=31536000, immutable"},
)
+18
View File
@@ -43,8 +43,10 @@ class MonitorConfig(BaseModel):
dinsar_dirs: List[str] = []
gf3_archive_source_dirs: List[str] = []
gf3_source_dirs: List[str] = []
gf3_legacy_gdal_enabled: bool = False
gf3_sarscape_native_dirs: List[str] = []
gf3_storage_dirs: List[str] = []
gf3_sarscape_runtime_dir: Optional[str] = None
gf3_sarscape_wrapper_exe: Optional[str] = None
gf3_sarscape_idlrt_path: Optional[str] = None
gf3_sarscape_dem_path: Optional[str] = None
@@ -159,6 +161,14 @@ async def run_gf3_batch_process(admin_user: AuthUserORM = Depends(_require_admin
"""
批量 GF3 L1A→L2 处理:扫描 GF3_SOURCE_DIRS,过滤已处理的,逐个处理并自动入库。
"""
if not settings.GF3_LEGACY_GDAL_ENABLED:
raise HTTPException(
status_code=409,
detail=(
"Legacy GF3 Python/GDAL preprocessing is disabled. "
"Use GF3 SARscape production or set GF3_LEGACY_GDAL_ENABLED=true explicitly."
),
)
gf3_source_dirs = MONITOR_CONFIG.get("gf3_source_dirs") or []
if not gf3_source_dirs:
raise HTTPException(status_code=400, detail="GF3_SOURCE_DIRS is not configured.")
@@ -331,6 +341,14 @@ async def run_gf3_unpack(
"""
将 GF3 压缩包池解包到 GF3_SOURCE_DIRS,作为后续 L1A→L2 预处理输入。
"""
if not settings.GF3_LEGACY_GDAL_ENABLED:
raise HTTPException(
status_code=409,
detail=(
"Legacy GF3 archive unpack is disabled. "
"Use GF3 SARscape production or set GF3_LEGACY_GDAL_ENABLED=true explicitly."
),
)
gf3_archive_source_dirs = MONITOR_CONFIG.get("gf3_archive_source_dirs") or []
gf3_source_dirs = MONITOR_CONFIG.get("gf3_source_dirs") or []
if not gf3_archive_source_dirs:
+5 -1
View File
@@ -142,4 +142,8 @@ async def get_psinsar_product_preview(
preview_path = str(detail.get("preview_path") or "").strip()
if not preview_path or not os.path.isfile(preview_path):
raise HTTPException(status_code=404, detail="Preview not found")
return FileResponse(preview_path, media_type="image/png")
return FileResponse(
preview_path,
media_type="image/png",
headers={"Cache-Control": "public, max-age=31536000, immutable"},
)
@@ -479,6 +479,7 @@ async def get_landsar_sbas_run_artifact(run_id: str, relative_path: str):
artifact_path,
media_type=media_type,
filename=artifact_path.name,
headers={"Cache-Control": "public, max-age=31536000, immutable"},
)
@@ -1022,6 +1023,7 @@ async def get_sbas_insar_run_artifact(run_id: str, relative_path: str):
artifact_path,
media_type=media_type,
filename=artifact_path.name,
headers={"Cache-Control": "public, max-age=31536000, immutable"},
)
@@ -1054,4 +1056,5 @@ async def get_sbas_insar_artifact(trial_id: str, relative_path: str):
artifact_path,
media_type=media_type,
filename=artifact_path.name,
headers={"Cache-Control": "public, max-age=31536000, immutable"},
)
+3 -1
View File
@@ -21,6 +21,7 @@ from .dependencies import _add_operation_audit_log, _get_current_user, _require_
router = APIRouter()
STATIC_ASSET_CACHE_HEADERS = {"Cache-Control": "public, max-age=31536000, immutable"}
class SbasInsarCatalogRebuildRequest(BaseModel):
@@ -189,7 +190,7 @@ async def get_sbas_insar_product_preview(
preview_path = str(detail.get("preview_path") or "").strip()
if not preview_path or not os.path.isfile(preview_path):
raise HTTPException(status_code=404, detail="Preview not found")
return FileResponse(preview_path, media_type="image/png")
return FileResponse(preview_path, media_type="image/png", headers=STATIC_ASSET_CACHE_HEADERS)
@router.get("/sbas-insar-products/{product_db_id}/assets/{asset_id}")
@@ -209,4 +210,5 @@ async def get_sbas_insar_product_asset(
asset.absolute_path,
media_type=asset.media_type or "application/octet-stream",
filename=asset.asset_name or os.path.basename(asset.absolute_path),
headers=STATIC_ASSET_CACHE_HEADERS,
)
+8
View File
@@ -902,6 +902,14 @@ async def submit_gf3_process(
admin_user: AuthUserORM = Depends(_require_admin),
):
"""提交 GF3 L1A→L2 处理任务(辐射定标 + RPC 几何校正)。"""
if not settings.GF3_LEGACY_GDAL_ENABLED:
raise HTTPException(
status_code=409,
detail=(
"Legacy GF3 Python/GDAL preprocessing is disabled. "
"Use /monitor/gf3-sarscape-produce or /monitor/gf3-sarscape-sync."
),
)
if not os.path.exists(req.input_dir):
raise HTTPException(status_code=400, detail=f"输入路径不存在: {req.input_dir}")