Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: dashboard/dashboard/pinpoint/models/job.py

Issue 3013013002: [pinpoint] Change refactor. (Closed)
Patch Set: UI Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 import collections 5 import collections
6 import logging 6 import logging
7 import os 7 import os
8 import traceback 8 import traceback
9 9
10 from google.appengine.api import taskqueue 10 from google.appengine.api import taskqueue
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 def _PostBugComment(self, status): 162 def _PostBugComment(self, status):
163 if not self.bug_id: 163 if not self.bug_id:
164 return 164 return
165 165
166 title = '%s Pinpoint job %s.' % (_ROUND_PUSHPIN, status) 166 title = '%s Pinpoint job %s.' % (_ROUND_PUSHPIN, status)
167 header = '\n'.join((title, self.url)) 167 header = '\n'.join((title, self.url))
168 168
169 # Include list of Changes. 169 # Include list of Changes.
170 change_details = [] 170 change_details = []
171 for _, change in self.state.Differences(): 171 for _, change in self.state.Differences():
172 # TODO: Only show the most specific Dep. 172 # TODO: Store the commit info in the Commit.
173 # TODO: Store the commit info in the Dep. 173 commit = change.last_commit
174 for dep in change.all_deps: 174 commit_info = gitiles_service.CommitInfo(commit.repository_url,
175 commit_info = gitiles_service.CommitInfo(dep.repository_url, dep.git_has h) 175 commit.git_hash)
176 subject = commit_info['message'].split('\n', 1)[0] 176 subject = commit_info['message'].split('\n', 1)[0]
177 author = commit_info['author']['email'] 177 author = commit_info['author']['email']
178 time = commit_info['committer']['time'] 178 time = commit_info['committer']['time']
179 179
180 byline = 'By %s %s %s' % (author, _MIDDLE_DOT, time) 180 byline = 'By %s %s %s' % (author, _MIDDLE_DOT, time)
181 git_link = dep.repository + '@' + dep.git_hash 181 git_link = commit.repository + '@' + commit.git_hash
182 change_details.append('\n'.join((subject, byline, git_link))) 182 change_details.append('\n'.join((subject, byline, git_link)))
183 183
184 comment = '\n\n'.join([header] + change_details) 184 comment = '\n\n'.join([header] + change_details)
185 185
186 issue_tracker = issue_tracker_service.IssueTrackerService( 186 issue_tracker = issue_tracker_service.IssueTrackerService(
187 utils.ServiceAccountHttp()) 187 utils.ServiceAccountHttp())
188 issue_tracker.AddBugComment(self.bug_id, comment, send_email=False) 188 issue_tracker.AddBugComment(self.bug_id, comment, send_email=False)
189 189
190 190
191 class _JobState(object): 191 class _JobState(object):
192 """The internal state of a Job. 192 """The internal state of a Job.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 for index in xrange(1, len(self._changes)): 252 for index in xrange(1, len(self._changes)):
253 change_a = self._changes[index - 1] 253 change_a = self._changes[index - 1]
254 change_b = self._changes[index] 254 change_b = self._changes[index]
255 255
256 comparison_result = self._Compare(change_a, change_b) 256 comparison_result = self._Compare(change_a, change_b)
257 if comparison_result == _DIFFERENT: 257 if comparison_result == _DIFFERENT:
258 # Different: Bisect and add an additional Change to the job. 258 # Different: Bisect and add an additional Change to the job.
259 try: 259 try:
260 midpoint = change_module.Change.Midpoint(change_a, change_b) 260 midpoint = change_module.Change.Midpoint(change_a, change_b)
261 except change_module.NonLinearError: 261 except change_module.NonLinearError:
262 midpoint = None 262 continue
263 if midpoint: 263 logging.info('Adding Change %s.', midpoint)
264 logging.info('Adding Change %s.', midpoint) 264 self.AddChange(midpoint, index)
265 self.AddChange(midpoint, index)
266 elif comparison_result == _SAME: 265 elif comparison_result == _SAME:
267 # The same: Do nothing. 266 # The same: Do nothing.
268 continue 267 continue
269 elif comparison_result == _UNKNOWN: 268 elif comparison_result == _UNKNOWN:
270 # Unknown: Add an Attempt to the Change with the fewest Attempts. 269 # Unknown: Add an Attempt to the Change with the fewest Attempts.
271 change = min(change_a, change_b, key=lambda c: len(self._attempts[c])) 270 change = min(change_a, change_b, key=lambda c: len(self._attempts[c]))
272 self.AddAttempt(change) 271 self.AddAttempt(change)
273 272
274 def ScheduleWork(self): 273 def ScheduleWork(self):
275 work_left = False 274 work_left = False
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 371
373 try: 372 try:
374 p_value = mann_whitney_u.MannWhitneyU(values_a, values_b) 373 p_value = mann_whitney_u.MannWhitneyU(values_a, values_b)
375 except ValueError: 374 except ValueError:
376 return _UNKNOWN 375 return _UNKNOWN
377 376
378 if p_value < _SIGNIFICANCE_LEVEL: 377 if p_value < _SIGNIFICANCE_LEVEL:
379 return _DIFFERENT 378 return _DIFFERENT
380 else: 379 else:
381 return _UNKNOWN 380 return _UNKNOWN
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698