~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/buildmaster/manager.py

  • Committer: Raphael Badin
  • Date: 2012-01-04 16:39:15 UTC
  • mto: This revision was merged to the branch mainline in revision 14654.
  • Revision ID: raphael.badin@canonical.com-20120104163915-googt0xvdw4fy9zm
Precache more data.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009 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
 
38
39
 
39
40
BUILDD_MANAGER_LOG_NAME = "slave-scanner"
49
50
def assessFailureCounts(builder, fail_notes):
50
51
    """View builder/job failure_count and work out which needs to die.  """
51
52
    # builder.currentjob hides a complicated query, don't run it twice.
52
 
    # See bug 623281.
 
53
    # See bug 623281 (Note that currentjob is a cachedproperty).
 
54
 
 
55
    del get_property_cache(builder).currentjob
53
56
    current_job = builder.currentjob
54
57
    if current_job is None:
55
58
        job_failure_count = 0
95
98
        # but that would cause us to query the slave for its status
96
99
        # again, and if the slave is non-responsive it holds up the
97
100
        # next buildd scan.
 
101
    del get_property_cache(builder).currentjob
98
102
 
99
103
 
100
104
class SlaveScanner: