mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2025-12-16 09:25:48 -07:00
Fixed Quick Jobs & Scheduled Jobs
This commit is contained in:
@@ -20,12 +20,15 @@ from __future__ import annotations
|
||||
import time
|
||||
from typing import TYPE_CHECKING, List
|
||||
|
||||
from ...assemblies.service import AssemblyRuntimeService
|
||||
from . import job_scheduler
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover - typing aide
|
||||
from flask import Flask
|
||||
|
||||
from .. import EngineServiceAdapters
|
||||
|
||||
|
||||
def ensure_scheduler(app: "Flask", adapters: "EngineServiceAdapters"):
|
||||
"""Instantiate the Engine job scheduler and attach it to the Engine context."""
|
||||
|
||||
@@ -36,6 +39,11 @@ def ensure_scheduler(app: "Flask", adapters: "EngineServiceAdapters"):
|
||||
if socketio is None:
|
||||
raise RuntimeError("Socket.IO instance is required to initialise the scheduled job service.")
|
||||
|
||||
assembly_cache = adapters.context.assembly_cache
|
||||
if assembly_cache is None:
|
||||
raise RuntimeError("Assembly cache is required to initialise the scheduled job service.")
|
||||
assembly_runtime = AssemblyRuntimeService(assembly_cache, logger=adapters.context.logger)
|
||||
|
||||
database_path = adapters.context.database_path
|
||||
script_signer = adapters.script_signer
|
||||
|
||||
@@ -87,6 +95,7 @@ def ensure_scheduler(app: "Flask", adapters: "EngineServiceAdapters"):
|
||||
database_path,
|
||||
script_signer=script_signer,
|
||||
service_logger=adapters.service_log,
|
||||
assembly_runtime=assembly_runtime,
|
||||
)
|
||||
job_scheduler.set_online_lookup(scheduler, _online_hostnames_snapshot)
|
||||
scheduler.start()
|
||||
|
||||
Reference in New Issue
Block a user