Handle internal errors in a better fashion: If a build would be marked as internal error, only do so if there are retries remaining. Otherwise, we mark it as failed (since it won't be rebuilt anyway)

This commit is contained in:
Joseph Schorr 2015-02-12 16:19:44 -05:00
parent e8458267fd
commit f84d1bad45
8 changed files with 70 additions and 19 deletions

View file

@ -60,8 +60,8 @@ class WorkQueue(object):
running_query = self._running_jobs(now, name_match_query)
running_count = running_query.distinct().count()
avialable_query = self._available_jobs_not_running(now, name_match_query, running_query)
available_count = avialable_query.select(QueueItem.queue_name).distinct().count()
available_query = self._available_jobs_not_running(now, name_match_query, running_query)
available_count = available_query.select(QueueItem.queue_name).distinct().count()
self._reporter(self._currently_processing, running_count, running_count + available_count)
@ -81,7 +81,7 @@ class WorkQueue(object):
params['available_after'] = available_date
with self._transaction_factory(db):
QueueItem.create(**params)
return QueueItem.create(**params)
def get(self, processing_time=300):
"""
@ -114,6 +114,7 @@ class WorkQueue(object):
item = AttrDict({
'id': db_item.id,
'body': db_item.body,
'retries_remaining': db_item.retries_remaining
})
self._currently_processing = True
@ -141,6 +142,7 @@ class WorkQueue(object):
incomplete_item_obj.save()
self._currently_processing = False
return incomplete_item_obj.retries_remaining > 0
def extend_processing(self, item, seconds_from_now, minimum_extension=MINIMUM_EXTENSION):
with self._transaction_factory(db):