Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flush usage_collector on shutdown #994

Merged
merged 10 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions inference/core/interfaces/http/http_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import base64
import os
import traceback
from contextlib import asynccontextmanager
from functools import partial, wraps
from time import sleep
from typing import Any, Dict, List, Optional, Union
Expand Down Expand Up @@ -494,8 +495,17 @@ def __init__(
Description:
Deploy Roboflow trained models to nearly any compute environment!
"""

description = "Roboflow inference server"

@asynccontextmanager
async def lifespan(app: FastAPI):
yield
logger.info("Shutting down %s", description)
await usage_collector.async_push_usage_payloads()

app = FastAPI(
lifespan=lifespan,
title="Roboflow Inference Server",
description=description,
version=__version__,
Expand Down
2 changes: 1 addition & 1 deletion inference/core/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.36.1"
__version__ = "0.36.2"


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.http.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
uvicorn[standard]<=0.22.0
uvicorn[standard]<=0.34.0
python-multipart==0.0.19
fastapi-cprofile<=0.0.2
orjson>=3.9.10,<=3.10.11
Expand Down