Skip to content

Commit

Permalink
fix getCurrentSummary for some steps
Browse files Browse the repository at this point in the history
adding a better message, with more info of who's wrong
Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
  • Loading branch information
Pierre Tardy committed Aug 11, 2014
1 parent c76de0c commit 0a96916
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions master/buildbot/process/buildstep.py
Expand Up @@ -354,22 +354,26 @@ def setProgress(self, metric, value):
self.progress.setProgress(metric, value)

def getCurrentSummary(self):
return u'running'
return {u'step': u'running'}

def getResultSummary(self):
return {}

@debounce.method(wait=1)
@defer.inlineCallbacks
def updateSummary(self):
def methodInfo(m):
import inspect
lines = inspect.getsourcelines(m)
return "\nat {0}:{1}:\n {2}".format(inspect.getsourcefile(m), lines[1], "\n".join(lines[0]))
if not self._running:
summary = yield self.getResultSummary()
if not isinstance(summary, dict):
raise TypeError('getResultSummary must return a dictionary')
raise TypeError('getResultSummary must return a dictionary: ' + methodInfo(self.getCurrentSummary))
else:
summary = yield self.getCurrentSummary()
if not isinstance(summary, dict):
raise TypeError('getCurrentSummary must return a dictionary')
raise TypeError('getCurrentSummary must return a dictionary: ' + methodInfo(self.getCurrentSummary))

stepResult = summary.get('step', u'finished')
if not isinstance(stepResult, unicode):
Expand Down
4 changes: 2 additions & 2 deletions master/buildbot/steps/trigger.py
Expand Up @@ -227,9 +227,9 @@ def run(self):
defer.returnValue(results)

def getResultSummary(self):
return {'step': self.getCurrentSummary()} if self.triggeredNames else {}
return {u'step': self.getCurrentSummary()[u'step']} if self.triggeredNames else {}

def getCurrentSummary(self):
if not self.triggeredNames:
return u'running'
return u'triggered %s' % (u', '.join(self.triggeredNames))
return {u'step': u'triggered %s' % (u', '.join(self.triggeredNames))}
2 changes: 1 addition & 1 deletion master/docs/developer/cls-buildsteps.rst
Expand Up @@ -232,7 +232,7 @@ BuildStep
:returns: dictionary, optionally via Deferred

Returns a dictionary containing status information for a running step.
The dictionary can a ``step`` key with a unicode value giving a summary for display with the step.
The dictionary can have a ``step`` key with a unicode value giving a summary for display with the step.
This method is only called while the step is running.

New-style build steps should override this method to provide a more interesting summary than the default ``u"running"``.
Expand Down

0 comments on commit 0a96916

Please sign in to comment.