feat: Add flag for enabling batch polling (#1651)
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -205,6 +205,7 @@ class Settings(BaseSettings):
|
||||
httpx_keepalive_expiry: float = 120.0
|
||||
|
||||
# cron job parameters
|
||||
enable_batch_job_polling: bool = False
|
||||
poll_running_llm_batches_interval_seconds: int = 5 * 60
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user