[enh] store repo state

This commit is contained in:
Laurent Peuch 2018-09-08 08:27:47 +02:00
parent 768507df8c
commit 480bda0e9a
2 changed files with 12 additions and 0 deletions

View file

@ -9,6 +9,11 @@ class Repo(peewee.Model):
revision = peewee.CharField(null=True)
app_list = peewee.CharField(null=True)
state = peewee.CharField(choices=(
('working', 'Working'),
('other_than_working', 'Other than working'),
), default="other_than_working")
class Meta:
database = db

7
run.py
View file

@ -173,6 +173,12 @@ async def monitor_apps_lists(type="stable"):
await create_job(app_id, app_list_name, repo, job_command_last_part)
repo_state = "working" if app_data["state"] in ("working", "validated") else "other_than_working"
if repo.state != repo_state:
repo.state = repo_state
repo.save()
# new app
else:
task_logger.info(f"New application detected: {app_id} in {app_list_name}, scheduling a new job")
@ -181,6 +187,7 @@ async def monitor_apps_lists(type="stable"):
url=app_data["git"]["url"],
revision=commit_sha,
app_list=app_list_name,
state="working" if app_data["state"] in ("working", "validated") else "other_than_working",
)
await create_job(app_id, app_list_name, repo, job_command_last_part)