Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/routes_connectors.py +42 -0
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
RELEASES.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": []
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "05336044da",
|
| 3 |
"releases": []
|
| 4 |
}
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
05336044da
|
api/routes_connectors.py
CHANGED
|
@@ -3021,6 +3021,44 @@ def _daily_completed_sync(rt, connector_key):
|
|
| 3021 |
return None, False
|
| 3022 |
|
| 3023 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3024 |
@router.get("/connectors/{connector_key}/sync-capability")
|
| 3025 |
def connector_sync_capability(connector_key: str, session: Session = Depends(require_session)):
|
| 3026 |
"""Declare registry-backed sync support without reading a tenant's database catalogue."""
|
|
@@ -3054,6 +3092,10 @@ def connector_sync_status(connector_key: str, connection_id: str = None,
|
|
| 3054 |
completed, known = None, False
|
| 3055 |
else:
|
| 3056 |
completed, known = _daily_completed_sync(rt, connector_key)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3057 |
answer.update(schedule="daily", lastCompletedAt=completed, lastSyncAt=completed,
|
| 3058 |
lastCompletedKnown=known, canSync=bool(session.admin),
|
| 3059 |
**_daily_sync_staleness(completed))
|
|
|
|
| 3021 |
return None, False
|
| 3022 |
|
| 3023 |
|
| 3024 |
+
_SAVED_COMPLETION_CACHE = {}
|
| 3025 |
+
_SAVED_COMPLETION_TTL = 60.0
|
| 3026 |
+
|
| 3027 |
+
|
| 3028 |
+
def _amazon_restore_pending(rt):
|
| 3029 |
+
"""True on a web process while the sync worker has not yet handed the Amazon mirror over."""
|
| 3030 |
+
try:
|
| 3031 |
+
import process_role
|
| 3032 |
+
if process_role.role() != "web":
|
| 3033 |
+
return False
|
| 3034 |
+
return (not process_role.worker_boot_restored()
|
| 3035 |
+
or f"{rt.key}/amazon" in process_role.pending_handoffs())
|
| 3036 |
+
except Exception: # noqa: BLE001
|
| 3037 |
+
return False
|
| 3038 |
+
|
| 3039 |
+
|
| 3040 |
+
def _amazon_saved_completion(rt):
|
| 3041 |
+
"""The saved mirror manifest's completed_at as a public stamp, or None."""
|
| 3042 |
+
key = str(getattr(rt, "key", "") or "")
|
| 3043 |
+
now = time.monotonic()
|
| 3044 |
+
cached = _SAVED_COMPLETION_CACHE.get(key)
|
| 3045 |
+
if cached is not None and now - cached[0] < _SAVED_COMPLETION_TTL:
|
| 3046 |
+
return cached[1]
|
| 3047 |
+
stamp = None
|
| 3048 |
+
try:
|
| 3049 |
+
from harness import amazon_store as az
|
| 3050 |
+
# Read the manifest object only: never rt.get, never a duckdb connection.
|
| 3051 |
+
download = getattr(rt, "download_bytes", None)
|
| 3052 |
+
raw = download(az.MIRROR_PREFIX + "manifest.json") if callable(download) else None
|
| 3053 |
+
manifest = json.loads(raw) if raw else None
|
| 3054 |
+
if isinstance(manifest, dict) and manifest.get("snapshot_id") and manifest.get("completed_at"):
|
| 3055 |
+
stamp = _sync_stamp(manifest["completed_at"])
|
| 3056 |
+
except Exception: # noqa: BLE001
|
| 3057 |
+
stamp = None
|
| 3058 |
+
_SAVED_COMPLETION_CACHE[key] = (now, stamp)
|
| 3059 |
+
return stamp
|
| 3060 |
+
|
| 3061 |
+
|
| 3062 |
@router.get("/connectors/{connector_key}/sync-capability")
|
| 3063 |
def connector_sync_capability(connector_key: str, session: Session = Depends(require_session)):
|
| 3064 |
"""Declare registry-backed sync support without reading a tenant's database catalogue."""
|
|
|
|
| 3092 |
completed, known = None, False
|
| 3093 |
else:
|
| 3094 |
completed, known = _daily_completed_sync(rt, connector_key)
|
| 3095 |
+
# While the worker's hand-off is pending, the store's completed publication stands in.
|
| 3096 |
+
if connector_key == "amazon_sp" and completed is None and known and _amazon_restore_pending(rt):
|
| 3097 |
+
completed = _amazon_saved_completion(rt)
|
| 3098 |
+
answer["restoring"] = True
|
| 3099 |
answer.update(schedule="daily", lastCompletedAt=completed, lastSyncAt=completed,
|
| 3100 |
lastCompletedKnown=known, canSync=bool(session.admin),
|
| 3101 |
**_daily_sync_staleness(completed))
|
web/public/AIOS_DEPLOY_RECEIPT
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
d9d53324b71a6a7fdad9b1e05cd711f03b28db110c39f3f32cec0889232200aa
|