fix: better debug logs

This commit is contained in:
Krrish Dholakia 2024-03-19 19:28:26 -07:00
parent e0d3b18835
commit f6de3a0359
3 changed files with 13 additions and 8 deletions

View file

@ -53,11 +53,6 @@ RUN pip install *.whl /wheels/* --no-index --find-links=/wheels/ && rm -f *.whl
# install semantic-cache [Experimental]- we need this here and not in requirements.txt because redisvl pins to pydantic 1.0
RUN pip install redisvl==0.0.7 --no-deps
# ensure pyjwt is used, not jwt
RUN pip uninstall jwt -y
RUN pip uninstall PyJWT -y
RUN pip install PyJWT --no-cache-dir
# Build Admin UI
RUN chmod +x build_admin_ui.sh && ./build_admin_ui.sh

View file

@ -2652,6 +2652,12 @@ async def startup_event():
### START BUDGET SCHEDULER ###
if prisma_client is not None:
scheduler = AsyncIOScheduler()
verbose_proxy_logger.debug(
f"proxy_budget_rescheduler_max_time: {proxy_budget_rescheduler_max_time}"
)
verbose_proxy_logger.debug(
f"proxy_budget_rescheduler_min_time: {proxy_budget_rescheduler_min_time}"
)
interval = random.randint(
proxy_budget_rescheduler_min_time, proxy_budget_rescheduler_max_time
) # random interval, so multiple workers avoid resetting budget at the same time

View file

@ -1817,6 +1817,7 @@ async def reset_budget(prisma_client: PrismaClient):
Updates db
"""
verbose_proxy_logger.debug("ENTERS RESET BUDGET")
if prisma_client is not None:
### RESET KEY BUDGET ###
now = datetime.utcnow()
@ -1828,12 +1829,15 @@ async def reset_budget(prisma_client: PrismaClient):
)
### RESET USER BUDGET ###
asyncio.create_task(
prisma_client.db.litellm_usertable.update_many(
verbose_proxy_logger.debug("STARTS RESETTING USER BUDGET")
try:
await prisma_client.db.litellm_usertable.update_many(
where={"budget_reset_at": {"lt": now}},
data={"spend": 0, "budget_reset_at": now},
)
)
except Exception as e:
verbose_proxy_logger.debug(f"An exception occurs - {str(e)}")
raise e
async def update_spend(