Fix Scheduler errors with the internal apis

This commit is contained in:
Théophile Diot 2023-05-31 14:19:35 -04:00
parent 89a3c8b0b6
commit 8b697d87d1
No known key found for this signature in database
GPG Key ID: E752C80DB72BB014
2 changed files with 13 additions and 5 deletions

View File

@ -62,6 +62,12 @@ class JobScheduler(ApiCaller):
def env(self, env: Dict[str, Any]):
self.__env = env
def set_integration(self, integration: str):
self.__integration = integration
def auto_setup(self):
super().auto_setup(bw_integration=self.__integration)
def __get_jobs(self):
jobs = {}
for plugin_file in glob(

View File

@ -201,6 +201,9 @@ if __name__ == "__main__":
)
dotenv_env = dotenv_values(str(tmp_variables_path))
# Instantiate scheduler
SCHEDULER = JobScheduler(environ.copy(), logger)
logger.info("Scheduler started ...")
# Checking if the argument variables is true.
@ -231,6 +234,10 @@ if __name__ == "__main__":
del integration_path
SCHEDULER.set_integration(INTEGRATION)
# Automatically setup the scheduler apis
SCHEDULER.auto_setup()
db = Database(
logger,
sqlalchemy_string=getenv("DATABASE_URI", None),
@ -370,11 +377,6 @@ if __name__ == "__main__":
"Looks like BunkerWeb configuration is already generated, will not GENERATE it again ..."
)
# Instantiate scheduler
SCHEDULER = JobScheduler(env.copy() | environ.copy(), logger, INTEGRATION)
# Automatically setup the scheduler apis
SCHEDULER.auto_setup(bw_integration=INTEGRATION)
FIRST_RUN = True
while True:
ret = db.checked_changes()