feat: Add flag for enabling batch polling (#1651)

This commit is contained in:
Matthew Zhou
2025-04-09 15:42:18 -07:00
committed by GitHub
parent c7d4ce73b0
commit 39dcaf1be7
2 changed files with 14 additions and 11 deletions

View File

@@ -12,17 +12,19 @@ scheduler = AsyncIOScheduler()
def start_cron_jobs(server: SyncServer):
"""Initialize cron jobs"""
scheduler.add_job(
poll_running_llm_batches,
args=[server],
trigger=IntervalTrigger(seconds=settings.poll_running_llm_batches_interval_seconds),
next_run_time=datetime.datetime.now(datetime.UTC),
id="poll_llm_batches",
name="Poll LLM API batch jobs and update status",
replace_existing=True,
)
scheduler.start()
if settings.enable_batch_job_polling:
scheduler.add_job(
poll_running_llm_batches,
args=[server],
trigger=IntervalTrigger(seconds=settings.poll_running_llm_batches_interval_seconds),
next_run_time=datetime.datetime.now(datetime.UTC),
id="poll_llm_batches",
name="Poll LLM API batch jobs and update status",
replace_existing=True,
)
scheduler.start()
def shutdown_cron_scheduler():
scheduler.shutdown()
if settings.enable_batch_job_polling:
scheduler.shutdown()