~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/buildmaster/manager.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:
1
 
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
"""Soyuz buildd slave manager logic."""
34
34
    BuildBehaviorMismatch,
35
35
    )
36
36
from lp.buildmaster.model.builder import Builder
 
37
from lp.services.propertycache import get_property_cache
37
38
from lp.services.database.transaction_policy import DatabaseTransactionPolicy
38
39
 
39
40
 
50
51
def assessFailureCounts(builder, fail_notes):
51
52
    """View builder/job failure_count and work out which needs to die.  """
52
53
    # builder.currentjob hides a complicated query, don't run it twice.
53
 
    # See bug 623281.
 
54
    # See bug 623281 (Note that currentjob is a cachedproperty).
 
55
 
 
56
    del get_property_cache(builder).currentjob
54
57
    current_job = builder.currentjob
55
58
    if current_job is None:
56
59
        job_failure_count = 0
64
67
        # we can do is try them both again, and hope that the job
65
68
        # runs against a different builder.
66
69
        current_job.reset()
 
70
        del get_property_cache(builder).currentjob
67
71
        return
68
72
 
69
73
    if builder.failure_count > job_failure_count:
96
100
        # but that would cause us to query the slave for its status
97
101
        # again, and if the slave is non-responsive it holds up the
98
102
        # next buildd scan.
 
103
    del get_property_cache(builder).currentjob
99
104
 
100
105
 
101
106
class SlaveScanner: