mirror of
https://github.com/YunoHost/yunorunner.git
synced 2024-09-03 20:05:52 +02:00
[enh] set random day for repo at startup if none
This commit is contained in:
parent
347ca0c77f
commit
5dc2c34a29
1 changed files with 9 additions and 0 deletions
9
run.py
9
run.py
|
@ -104,6 +104,13 @@ def reset_busy_workers():
|
||||||
Worker.update(state="available").execute()
|
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):
|
async def create_job(app_id, app_list_name, repo, job_command_last_part):
|
||||||
if isinstance(job_command_last_part, str):
|
if isinstance(job_command_last_part, str):
|
||||||
job = Job.create(
|
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_pending_jobs()
|
||||||
reset_busy_workers()
|
reset_busy_workers()
|
||||||
|
|
||||||
|
set_random_day_for_monthy_job()
|
||||||
|
|
||||||
app.config.path_to_analyseCI = path_to_analyseCI
|
app.config.path_to_analyseCI = path_to_analyseCI
|
||||||
|
|
||||||
if not dont_minotor_apps_list:
|
if not dont_minotor_apps_list:
|
||||||
|
|
Loading…
Add table
Reference in a new issue