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

Unified Diff: dashboard/dashboard/pinpoint/models/job.py

Issue 3014583002: [pinpoint] Add message in bug when there are no change points. (Closed)
Patch Set: Wording 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dashboard/dashboard/pinpoint/elements/job-page-header.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/pinpoint/models/job.py
diff --git a/dashboard/dashboard/pinpoint/models/job.py b/dashboard/dashboard/pinpoint/models/job.py
index 2d625aeb3824a8399301a89a2ddc143ea7e57d41..bce3280e54abbc3e11f12ed63252dbc1fe12f362 100644
--- a/dashboard/dashboard/pinpoint/models/job.py
+++ b/dashboard/dashboard/pinpoint/models/job.py
@@ -114,11 +114,11 @@ class Job(ndb.Model):
self._PostBugComment('started')
def Complete(self):
- self._PostBugComment('completed')
+ self._PostBugComment('completed', include_differences=True)
def Fail(self):
self.exception = traceback.format_exc()
- self._PostBugComment('stopped with an error')
+ self._PostBugComment('stopped with an error', include_differences=True)
def Schedule(self):
task = taskqueue.add(queue_name='job-queue', url='/api/run/' + self.job_id,
@@ -160,27 +160,29 @@ class Job(ndb.Model):
d.update(self.state.AsDict())
return d
- def _PostBugComment(self, status):
+ def _PostBugComment(self, status, include_differences=False):
if not self.bug_id:
return
title = '%s Pinpoint job %s.' % (_ROUND_PUSHPIN, status)
header = '\n'.join((title, self.url))
- # Include list of Changes.
change_details = []
- for _, change in self.state.Differences():
- # TODO: Store the commit info in the Commit.
- commit = change.last_commit
- commit_info = gitiles_service.CommitInfo(commit.repository_url,
- commit.git_hash)
- subject = '<b>%s</b>' % commit_info['message'].split('\n', 1)[0]
- author = commit_info['author']['email']
- time = commit_info['committer']['time']
-
- byline = 'By %s %s %s' % (author, _MIDDLE_DOT, time)
- git_link = commit.repository + '@' + commit.git_hash
- change_details.append('\n'.join((subject, byline, git_link)))
+ if include_differences:
+ # Include list of Changes.
+ differences = tuple(self.state.Differences())
+ if differences:
+ if len(differences) == 1:
+ change_details.append(
+ '<b>Found significant differences after 1 commit:</b>')
+ else:
+ change_details.append(
+ '<b>Found significant differences after each of %d commits:</b>' %
+ len(differences))
+ for _, change in differences:
+ change_details.append(_FormatChangeForBug(change))
+ else:
+ change_details.append("<b>Couldn't reproduce a difference.</b>")
comment = '\n\n'.join([header] + change_details)
@@ -352,6 +354,20 @@ class _JobState(object):
return _UNKNOWN
+def _FormatChangeForBug(change):
+ # TODO: Store the commit info in the Commit.
+ commit = change.last_commit
+ commit_info = gitiles_service.CommitInfo(commit.repository_url,
+ commit.git_hash)
+ subject = '<b>%s</b>' % commit_info['message'].split('\n', 1)[0]
+ author = commit_info['author']['email']
+ time = commit_info['committer']['time']
+
+ byline = 'By %s %s %s' % (author, _MIDDLE_DOT, time)
+ git_link = commit.repository + '@' + commit.git_hash
+ return '\n'.join((subject, byline, git_link))
+
+
def _CombineResultsPerQuest(attempts):
aggregate_results = collections.defaultdict(list)
for attempt in attempts:
« no previous file with comments | « dashboard/dashboard/pinpoint/elements/job-page-header.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698