fix(ops): harden cold-start schedule recovery
This commit is contained in:
@@ -18,17 +18,21 @@ import httpx
|
||||
async def main() -> int:
|
||||
api_base = os.environ.get(
|
||||
"INTERNAL_API_URL",
|
||||
"http://awoooi-api.awoooi-prod.svc.cluster.local:8000",
|
||||
"http://awoooi-api-svc.awoooi-prod.svc.cluster.local:8000",
|
||||
)
|
||||
url = f"{api_base}/api/v1/knowledge/embed-all"
|
||||
|
||||
async with httpx.AsyncClient(timeout=120) as client:
|
||||
async with httpx.AsyncClient(timeout=1800) as client:
|
||||
try:
|
||||
resp = await client.post(url)
|
||||
print(f"embed-all: {resp.status_code} {resp.text[:200]}")
|
||||
if resp.status_code >= 400:
|
||||
print(f"ERROR: embed-all returned {resp.status_code}", file=sys.stderr)
|
||||
return 1
|
||||
result = resp.json()
|
||||
if int(result.get("failed", 0)) > 0:
|
||||
print(f"ERROR: embed-all failed rows: {result}", file=sys.stderr)
|
||||
return 1
|
||||
return 0
|
||||
except httpx.RequestError as exc:
|
||||
print(f"ERROR: request failed — {exc}", file=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user