Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.
Python aiburrchatbot-frameworkdagsgenerative-aigraphshacktoberfestllmopsllmsmlopspersistent-data-structurestate-machinestate-managementvisibility
Adds a ready API for deploying burr telemetry
elijahbenizzyfa210d3d7fae
diff --git a/burr/tracking/server/run.py b/burr/tracking/server/run.pyindex 51d3a940..ea1a4255 100644--- a/burr/tracking/server/run.py+++ b/burr/tracking/server/run.py@@ -51,7 +51,6 @@ SERVE_STATIC = os.getenv("BURR_SERVE_STATIC", "true").lower() == "true"SENTINEL_PARTITION_KEY = "__none__"-backend = BackendBase.create_from_env()@@ -92,6 +91,9 @@ async def save_snapshot():logger.info("Saved snapshot of DB for recovery")+initialized = False++@asynccontextmanagerasync def lifespan(app: FastAPI):# Download if it does it@@ -101,6 +103,8 @@ async def lifespan(app: FastAPI):await backend.lifespan(app).__anext__()await sync_index() # this will trigger the repeat every N secondsawait save_snapshot() # this will trigger the repeat every N seconds+ global initialized+ initialized = Trueyieldawait backend.lifespan(app).__anext__()@@ -108,6 +112,15 @@ async def lifespan(app: FastAPI):app = FastAPI(lifespan=lifespan)[email protected]("/ready")+def is_ready():+ if not initialized:+ raise HTTPException(+ status_code=status.HTTP_503_SERVICE_UNAVAILABLE, detail="Backend is not ready yet."+ )+ return {"ready": True}++@app.get("/api/v0/metadata/app_spec", response_model=BackendSpec)def get_app_spec():is_indexing_backend = isinstance(backend, IndexingBackendMixin)