Fix issues with the Linux integration and external databases

This commit is contained in:
Théophile Diot 2023-11-14 16:07:23 +00:00
parent 71db00281d
commit bff775f006
No known key found for this signature in database
GPG key ID: 248FEA4BAE400D06
2 changed files with 3 additions and 2 deletions

View file

@ -38,13 +38,14 @@ class JobScheduler(ApiCaller):
logger: Optional[Logger] = None,
integration: str = "Linux",
*,
db: Optional[Database] = None,
lock: Optional[Lock] = None,
apis: Optional[list] = None,
):
super().__init__(apis or [])
self.__logger = logger or setup_logger("Scheduler", getenv("LOG_LEVEL", "INFO"))
self.__integration = integration
self.__db = Database(self.__logger)
self.__db = db or Database(self.__logger)
self.__env = env or {}
self.__env.update(environ)
self.__jobs = self.__get_jobs()

View file

@ -291,7 +291,7 @@ if __name__ == "__main__":
env["DATABASE_URI"] = db.database_uri
# Instantiate scheduler
SCHEDULER = JobScheduler(env.copy() | environ.copy(), logger, INTEGRATION)
SCHEDULER = JobScheduler(env.copy() | environ.copy(), logger, INTEGRATION, db=db)
if INTEGRATION in ("Docker", "Swarm", "Kubernetes", "Autoconf"):
# Automatically setup the scheduler apis