Fix indentation on build model operations
This commit is contained in:
parent
32fae5533c
commit
38cb63d195
1 changed files with 11 additions and 11 deletions
|
@ -166,20 +166,20 @@ def cancel_repository_build(build, work_queue):
|
|||
def get_archivable_build():
|
||||
presumed_dead_date = datetime.utcnow() - PRESUMED_DEAD_BUILD_AGE
|
||||
candidates = (RepositoryBuild
|
||||
.select(RepositoryBuild.id)
|
||||
.where((RepositoryBuild.phase == BUILD_PHASE.COMPLETE) |
|
||||
(RepositoryBuild.phase == BUILD_PHASE.ERROR) |
|
||||
(RepositoryBuild.started < presumed_dead_date),
|
||||
RepositoryBuild.logs_archived == False)
|
||||
.limit(50)
|
||||
.alias('candidates'))
|
||||
.select(RepositoryBuild.id)
|
||||
.where((RepositoryBuild.phase == BUILD_PHASE.COMPLETE) |
|
||||
(RepositoryBuild.phase == BUILD_PHASE.ERROR) |
|
||||
(RepositoryBuild.started < presumed_dead_date),
|
||||
RepositoryBuild.logs_archived == False)
|
||||
.limit(50)
|
||||
.alias('candidates'))
|
||||
|
||||
try:
|
||||
found_id = (RepositoryBuild
|
||||
.select(candidates.c.id)
|
||||
.from_(candidates)
|
||||
.order_by(db_random_func())
|
||||
.get())
|
||||
.select(candidates.c.id)
|
||||
.from_(candidates)
|
||||
.order_by(db_random_func())
|
||||
.get())
|
||||
return RepositoryBuild.get(id=found_id)
|
||||
except RepositoryBuild.DoesNotExist:
|
||||
return None
|
||||
|
|
Reference in a new issue