| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from google.appengine.ext import ndb | 5 from google.appengine.ext import ndb |
| 6 from google.appengine.ext.webapp import template | 6 from google.appengine.ext.webapp import template |
| 7 | 7 |
| 8 from model.flake import Flake | 8 from model.flake import Flake |
| 9 | 9 |
| 10 import datetime | 10 import datetime |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 failure_runs_keys.append(o.failure_run) | 47 failure_runs_keys.append(o.failure_run) |
| 48 patchsets_keys.append(o.failure_run.parent()) | 48 patchsets_keys.append(o.failure_run.parent()) |
| 49 matching_flakes = [f for f in o.flakes if f.failure == flake.name] | 49 matching_flakes = [f for f in o.flakes if f.failure == flake.name] |
| 50 flakes.append(matching_flakes) | 50 flakes.append(matching_flakes) |
| 51 step_names.update(normalize_test_type(f.name) for f in matching_flakes) | 51 step_names.update(normalize_test_type(f.name) for f in matching_flakes) |
| 52 | 52 |
| 53 failure_runs = filterNone(ndb.get_multi(failure_runs_keys)) | 53 failure_runs = filterNone(ndb.get_multi(failure_runs_keys)) |
| 54 patchsets = filterNone(ndb.get_multi(patchsets_keys)) | 54 patchsets = filterNone(ndb.get_multi(patchsets_keys)) |
| 55 | 55 |
| 56 class FailureRunExtended: | 56 class FailureRunExtended: |
| 57 def __init__(self, url, patchset_url, builder, formatted_time, issue_ids, | 57 def __init__(self, url, milo_url, patchset_url, builder, formatted_time, |
| 58 time_finished): | 58 issue_ids, time_finished): |
| 59 self.url = url | 59 self.url = url |
| 60 self.milo_url = milo_url |
| 60 self.patchset_url = patchset_url | 61 self.patchset_url = patchset_url |
| 61 self.builder = builder | 62 self.builder = builder |
| 62 self.formatted_time = formatted_time | 63 self.formatted_time = formatted_time |
| 63 self.issue_ids = issue_ids | 64 self.issue_ids = issue_ids |
| 64 self.time_finished = time_finished | 65 self.time_finished = time_finished |
| 65 | 66 |
| 66 failure_runs_extended = [] | 67 failure_runs_extended = [] |
| 67 for index, fr in enumerate(failure_runs): | 68 for index, fr in enumerate(failure_runs): |
| 68 failure_runs_extended.append(FailureRunExtended( | 69 failure_runs_extended.append(FailureRunExtended( |
| 69 fr.getURL(), | 70 fr.getURL(), |
| 71 fr.getMiloURL(), |
| 70 patchsets[index].getURL(), | 72 patchsets[index].getURL(), |
| 71 patchsets[index].builder, | 73 patchsets[index].builder, |
| 72 fr.time_finished.strftime('%Y-%m-%d %H:%M:%S UTC'), | 74 fr.time_finished.strftime('%Y-%m-%d %H:%M:%S UTC'), |
| 73 set([f.issue_id for f in flakes[index] if f.issue_id > 0]), | 75 set([f.issue_id for f in flakes[index] if f.issue_id > 0]), |
| 74 fr.time_finished, | 76 fr.time_finished, |
| 75 )) | 77 )) |
| 76 | 78 |
| 77 # Do simple sorting to make reading easier. | 79 # Do simple sorting to make reading easier. |
| 78 failure_runs_extended = sorted( | 80 failure_runs_extended = sorted( |
| 79 failure_runs_extended, key=RunsSortFunction, reverse=True) | 81 failure_runs_extended, key=RunsSortFunction, reverse=True) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 flake = ndb.Key(urlsafe=key).get() | 127 flake = ndb.Key(urlsafe=key).get() |
| 126 assert flake | 128 assert flake |
| 127 except Exception: | 129 except Exception: |
| 128 self.response.set_status(404, 'Failed to find flake with id "%s"' % key) | 130 self.response.set_status(404, 'Failed to find flake with id "%s"' % key) |
| 129 return | 131 return |
| 130 | 132 |
| 131 show_all = self.request.get('show_all', 0) | 133 show_all = self.request.get('show_all', 0) |
| 132 data = show_all_flakes(flake, show_all) | 134 data = show_all_flakes(flake, show_all) |
| 133 html = template.render('templates/all_flake_occurrences.html', data) | 135 html = template.render('templates/all_flake_occurrences.html', data) |
| 134 self.response.write(html) | 136 self.response.write(html) |
| OLD | NEW |