From 5dc2c34a2939c537a539320df2c6882068aa5b64 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Tue, 11 Sep 2018 08:12:09 +0200 Subject: [PATCH] [enh] set random day for repo at startup if none --- run.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/run.py b/run.py index fab4704..16684e2 100644 --- a/run.py +++ b/run.py @@ -104,6 +104,13 @@ def reset_busy_workers(): Worker.update(state="available").execute() +def set_random_day_for_monthy_job(): + for repo in Repo.select().where((Repo.random_job_day == None)): + repo.random_job_day = random.randint(1, 28) + task_logger.info(f"set random day for montly job of repo '{repo.name}' at '{repo.random_job_day}'") + repo.save() + + async def create_job(app_id, app_list_name, repo, job_command_last_part): if isinstance(job_command_last_part, str): job = Job.create( @@ -546,6 +553,8 @@ def main(path_to_analyseCI, ssl=False, keyfile_path="/etc/yunohost/certs/ci-apps reset_pending_jobs() reset_busy_workers() + set_random_day_for_monthy_job() + app.config.path_to_analyseCI = path_to_analyseCI if not dont_minotor_apps_list: