Archived logs commit 1. Squash me.

This commit is contained in:
Jake Moshenko 2014-09-08 16:43:17 -04:00
parent 54fbb2a4c0
commit 451e034ca1
9 changed files with 402 additions and 22 deletions

View file

@ -12,6 +12,7 @@ from util.backoff import exponential_backoff
EXPONENTIAL_BACKOFF_SCALE = timedelta(seconds=1)
PRESUMED_DEAD_BUILD_AGE = timedelta(days=15)
logger = logging.getLogger(__name__)
@ -1877,3 +1878,11 @@ def confirm_email_authorization_for_repo(code):
found.save()
return found
def archivable_buildlogs_query():
presumed_dead_date = datetime.utcnow() - PRESUMED_DEAD_BUILD_AGE
return (RepositoryBuild.select()
.where((RepositoryBuild.phase == BUILD_PHASE.COMPLETE) |
(RepositoryBuild.phase == BUILD_PHASE.ERROR) |
(RepositoryBuild.started < presumed_dead_date), RepositoryBuild.logs_archived == False))