Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import base64 | |
| 6 from collections import defaultdict | |
| 7 import copy | |
| 8 from datetime import datetime | |
| 9 import json | |
| 10 import os | |
| 11 | |
| 12 from google.appengine.ext import ndb | |
| 13 from google.appengine.api import users | |
| 14 | |
| 15 from common import constants | |
| 16 from common import time_util | |
| 17 from common.base_handler import BaseHandler | |
| 18 from common.base_handler import Permission | |
| 19 from handlers import handlers_util | |
| 20 from handlers import result_status | |
| 21 from handlers.result_status import NO_TRY_JOB_REASON_MAP | |
| 22 from model.crash.fracas_crash_analysis import FracasCrashAnalysis | |
| 23 from model import triage_status | |
| 24 | |
| 25 | |
| 26 class FracasResultFeedback(BaseHandler): | |
| 27 PERMISSION_LEVEL = Permission.ANYONE | |
| 28 | |
| 29 def _GetCrashDataFromAnalysis(self, analysis): | |
|
Martin Barbella
2016/06/17 22:14:32
Could this be useful anywhere else? Would it make
Sharu Jiang
2016/06/17 23:58:22
Done.
| |
| 30 return { | |
| 31 'signature': analysis.signature, | |
| 32 'version': analysis.crashed_version, | |
| 33 'channel': analysis.channel, | |
| 34 'platform': analysis.platform, | |
| 35 'regression_range': ( | |
| 36 analysis.result['regression_range'] if 'regression_range' in | |
| 37 analysis.result else None), | |
| 38 'historical_metadata': analysis.historical_metadata, | |
| 39 'stack_trace': analysis.stack_trace, | |
| 40 'suspected_cls': ( | |
| 41 analysis.result['suspected_cls'] if 'suspected_cls' in | |
| 42 analysis.result else None), | |
| 43 'suspected_project': ( | |
| 44 analysis.result['suspected_project'] if 'suspected_project' in | |
| 45 analysis.result else None), | |
| 46 'suspected_components': ( | |
| 47 analysis.result['suspected_components'] if 'suspected_components' | |
| 48 in analysis.result else None), | |
| 49 'request_time': time_util.FormatDatetime(analysis.requested_time), | |
| 50 'analysis_completed': analysis.completed, | |
| 51 'analysis_failed': analysis.failed, | |
| 52 } | |
| 53 | |
| 54 def HandleGet(self): | |
| 55 """Triggers analysis of a build failure on demand and return current result. | |
| 56 | |
| 57 If the final analysis result is available, set cache-control to 1 day to | |
| 58 avoid overload by unnecessary and frequent query from clients; otherwise | |
| 59 set cache-control to 5 seconds to allow repeated query. | |
| 60 | |
| 61 Serve HTML page or JSON result as requested. | |
| 62 """ | |
| 63 key = ndb.Key(urlsafe=self.request.get('key')) | |
| 64 | |
| 65 analysis = key.get() | |
| 66 if not analysis: # pragma: no cover. | |
| 67 return BaseHandler.CreateError( | |
| 68 'cannot find analysis for crash %s' % analysis.signature) | |
| 69 | |
| 70 return { | |
| 71 'template': 'crash/fracas_result_feedback.html', | |
| 72 'data': self._GetCrashDataFromAnalysis(analysis), | |
| 73 } | |
| 74 | |
| 75 def HandlePost(self): # pragma: no cover | |
| 76 return self.HandleGet() | |
| OLD | NEW |