From ea93a09b7a4632f6b5fcb47afdc4aa66df3ab944 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Thu, 27 Mar 2025 21:10:26 -0700 Subject: [PATCH] add model CronJob --- litellm/proxy/schema.prisma | 15 +++++++++++++++ schema.prisma | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/litellm/proxy/schema.prisma b/litellm/proxy/schema.prisma index 9269e89014..0df675fd84 100644 --- a/litellm/proxy/schema.prisma +++ b/litellm/proxy/schema.prisma @@ -336,3 +336,18 @@ model LiteLLM_DailyUserSpend { @@index([api_key]) @@index([model]) } + + +// Track the status of cron jobs running. Only allow one pod to run the job at a time +model CronJob { + id String @id @default(cuid()) // Unique ID for the record + podId String // Unique identifier for the pod acting as the leader + status JobStatus @default(INACTIVE) // Status of the cron job (active or inactive) + lastUpdated DateTime @default(now()) // Timestamp for the last update of the cron job record + ttl DateTime // Time when the leader's lease expires +} + +enum JobStatus { + ACTIVE + INACTIVE +} diff --git a/schema.prisma b/schema.prisma index 3312b26354..5d1535d2ff 100644 --- a/schema.prisma +++ b/schema.prisma @@ -335,3 +335,18 @@ model LiteLLM_DailyUserSpend { @@index([api_key]) @@index([model]) } + + +// Track the status of cron jobs running. Only allow one pod to run the job at a time +model CronJob { + id String @id @default(cuid()) // Unique ID for the record + podId String // Unique identifier for the pod acting as the leader + status JobStatus @default(INACTIVE) // Status of the cron job (active or inactive) + lastUpdated DateTime @default(now()) // Timestamp for the last update of the cron job record + ttl DateTime // Time when the leader's lease expires +} + +enum JobStatus { + ACTIVE + INACTIVE +}