Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | |
|
stgao
2016/06/20 05:02:51
Hm, my comments in the original CL seems not addre
Sharu Jiang
2016/06/21 20:17:11
Sorry, forgot the comments there ><
| |
| 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 HandleGet(self): | |
| 30 """Triggers analysis of a build failure on demand and return current result. | |
| 31 | |
| 32 If the final analysis result is available, set cache-control to 1 day to | |
| 33 avoid overload by unnecessary and frequent query from clients; otherwise | |
| 34 set cache-control to 5 seconds to allow repeated query. | |
| 35 | |
| 36 Serve HTML page or JSON result as requested. | |
| 37 """ | |
| 38 key = ndb.Key(urlsafe=self.request.get('key')) | |
| 39 | |
| 40 analysis = key.get() | |
| 41 if not analysis: # pragma: no cover. | |
| 42 return BaseHandler.CreateError( | |
| 43 'cannot find analysis for crash %s' % analysis.signature) | |
| 44 | |
| 45 data = { | |
| 46 'signature': analysis.signature, | |
| 47 'version': analysis.crashed_version, | |
| 48 'channel': analysis.channel, | |
| 49 'platform': analysis.platform, | |
| 50 'regression_range': ( | |
| 51 analysis.result['regression_range'] if 'regression_range' in | |
| 52 analysis.result else None), | |
| 53 'historical_metadata': analysis.historical_metadata, | |
| 54 'stack_trace': analysis.stack_trace, | |
| 55 'suspected_cls': ( | |
| 56 analysis.result['suspected_cls'] if 'suspected_cls' in | |
| 57 analysis.result else None), | |
| 58 'suspected_project': ( | |
| 59 analysis.result['suspected_project'] if 'suspected_project' in | |
| 60 analysis.result else None), | |
| 61 'suspected_components': ( | |
| 62 analysis.result['suspected_components'] if 'suspected_components' | |
| 63 in analysis.result else None), | |
| 64 'request_time': time_util.FormatDatetime(analysis.requested_time), | |
| 65 'analysis_completed': analysis.completed, | |
| 66 'analysis_failed': analysis.failed, | |
| 67 } | |
| 68 | |
| 69 return { | |
| 70 'template': 'crash/fracas_result_feedback.html', | |
| 71 'data': data, | |
| 72 } | |
| 73 | |
| 74 def HandlePost(self): # pragma: no cover | |
| 75 return self.HandleGet() | |
| OLD | NEW |