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

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

Issue 3014583002: [pinpoint] Add message in bug when there are no change points. (Closed)
Patch Set: 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 | « no previous file | 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 a2bf223084ee3787ffaf551eec2d48e5847920e5..d6ff7b4845c77891af3d76470146c37c2e8d08cd 100644
--- a/dashboard/dashboard/pinpoint/models/job.py
+++ b/dashboard/dashboard/pinpoint/models/job.py
@@ -114,7 +114,7 @@ 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()
@@ -159,27 +159,22 @@ 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 = 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 = self.state.Differences()
+ if differences:
+ for _, change in differences:
+ change_details.append(_FormatChangeForBug(change))
+ else:
+ change_details.append('No change points found.')
sullivan 2017/09/18 20:55:47 This might be a little confusing to users. "No sig
shatch 2017/09/18 21:00:14 Kinda wonder if people will ask what this means, m
perezju 2017/09/19 11:56:07 It would also help figure out the right wording if
comment = '\n\n'.join([header] + change_details)
@@ -353,6 +348,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 = 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 | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698