~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/buildmaster/model/builder.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2012-01-07 17:40:43 UTC
  • mfrom: (14513.3.18 builders-timeout-903827-2)
  • Revision ID: launchpad@pqm.canonical.com-20120107174043-8a8bkggm6n638o0f
[r=jcsackett][bug=903827] Make buildqueue.specific_job and
        builder.currentjob cached properties.

Show diffs side-by-side

added added

removed removed

Lines of Context:
431
431
 
432
432
    def _getCurrentBuildBehavior(self):
433
433
        """Return the current build behavior."""
 
434
        self._clean_currentjob_cache()
434
435
        if not safe_hasattr(self, '_current_build_behavior'):
435
436
            self._current_build_behavior = None
436
437
 
479
480
    def gotFailure(self):
480
481
        """See `IBuilder`."""
481
482
        self.failure_count += 1
 
483
        self._clean_currentjob_cache()
482
484
 
483
485
    def resetFailureCount(self):
484
486
        """See `IBuilder`."""
485
487
        self.failure_count = 0
 
488
        self._clean_currentjob_cache()
486
489
 
487
490
    def rescueIfLost(self, logger=None):
488
491
        """See `IBuilder`."""
498
501
 
499
502
    # XXX 2010-08-24 Julian bug=623281
500
503
    # This should not be a property!  It's masking a complicated query.
501
 
    @property
 
504
    @cachedproperty
502
505
    def currentjob(self):
503
506
        """See IBuilder"""
504
507
        return getUtility(IBuildQueueSet).getByBuilder(self)
505
508
 
 
509
    def _clean_currentjob_cache(self):
 
510
        del get_property_cache(self).currentjob
 
511
 
506
512
    def requestAbort(self):
507
513
        """See IBuilder."""
508
514
        return self.slave.abort()