Merge "Contain pipeline exceptions"

This commit is contained in:
Zuul 2020-06-08 22:22:07 +00:00 committed by Gerrit Code Review
commit f6e4d30ea1
2 changed files with 17 additions and 5 deletions

View File

@ -245,6 +245,9 @@ class Pipeline(object):
Reporter
Communicates success and failure results somewhere
"""
STATE_NORMAL = 'normal'
STATE_ERROR = 'error'
def __init__(self, name, tenant):
self.name = name
# Note that pipelines are not portable across tenants (new
@ -287,6 +290,7 @@ class Pipeline(object):
self.window_increase_factor = None
self.window_decrease_type = None
self.window_decrease_factor = None
self.state = self.STATE_NORMAL
@property
def actions(self):
@ -355,7 +359,8 @@ class Pipeline(object):
def formatStatusJSON(self, websocket_url=None):
j_pipeline = dict(name=self.name,
description=self.description)
description=self.description,
state=self.state)
j_queues = []
j_pipeline['change_queues'] = j_queues
for queue in self.queues:

View File

@ -1232,10 +1232,17 @@ class Scheduler(threading.Thread):
for tenant in self.abide.tenants.values():
for pipeline in tenant.layout.pipelines.values():
while (pipeline.manager.processQueue() and
not self._stopped):
pass
try:
while (pipeline.manager.processQueue() and
not self._stopped):
pass
except Exception:
self.log.exception(
"Exception in pipeline processing:")
pipeline.state = pipeline.STATE_ERROR
# Continue processing other pipelines+tenants
else:
pipeline.state = pipeline.STATE_NORMAL
except Exception:
self.log.exception("Exception in run handler:")
# There may still be more events to process