예제 #1
0
    def Fail(self, exception=None):
        tb = traceback.format_exc() or ''
        title = _CRYING_CAT_FACE + ' Pinpoint job stopped with an error.'
        exc_info = sys.exc_info()
        if exception is None:
            if exc_info[1] is None:
                # We've been called without a exception in sys.exc_info or in our args.
                # This should not happen.
                exception = errors.JobError('Unknown job error')
                exception.category = 'pinpoint'
            else:
                exception = exc_info[1]
        exc_message = exception.message
        category = None
        if isinstance(exception, errors.JobError):
            category = exception.category

        self.exception_details = {
            'message': exc_message,
            'traceback': tb,
            'category': category,
        }
        self.task = None

        comment = '\n'.join((title, self.url, '', exc_message))
        deferred.defer(_PostBugCommentDeferred,
                       self.bug_id,
                       comment,
                       _retry_options=RETRY_OPTIONS)
        scheduler.Complete(self)
예제 #2
0
파일: job.py 프로젝트: zloop1982/catapult
    def Fail(self, exception=None):
        tb = traceback.format_exc() or ''
        title = _CRYING_CAT_FACE + ' Pinpoint job stopped with an error.'
        exc_info = sys.exc_info()
        if exception is None:
            if exc_info[1] is None:
                # We've been called without a exception in sys.exc_info or in our args.
                # This should not happen.
                exception = errors.JobError('Unknown job error')
                exception.category = 'pinpoint'
            else:
                exception = exc_info[1]
        exc_message = exception.message
        category = None
        if isinstance(exception, errors.JobError):
            category = exception.category

        self.exception_details = {
            'message': exc_message,
            'traceback': tb,
            'category': category,
        }
        self.task = None

        comment = '\n'.join((title, self.url, '', exc_message))

        # Short-circuit jobs failure updates when we are not the first one to mark a
        # job done.
        if self.use_execution_engine and not MarkDone(self.job_id):
            return

        deferred.defer(_PostBugCommentDeferred,
                       self.bug_id,
                       comment,
                       project=self.project,
                       labels=job_bug_update.ComputeLabelUpdates(
                           ['Pinpoint-Job-Failed']),
                       send_email=True,
                       _retry_options=RETRY_OPTIONS)
        scheduler.Complete(self)