~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to cronscripts/buildd-slave-scanner.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-03-17 20:41:13 UTC
  • mfrom: (3277.1.4 launchpad-foobar2)
  • Revision ID: pqm@pqm.ubuntu.com-20060317204113-9841a4470db3611b
[r=jamesh] Mainline soyuz

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 
8
8
__metaclass__ = type
9
9
 
 
10
import _pythonpath
 
11
 
10
12
import sys
11
 
import logging
12
 
import os
13
13
from optparse import OptionParser
14
14
 
15
15
from zope.component import getUtility
16
16
 
17
17
from canonical.lp import initZopeless
 
18
from canonical.config import config
18
19
from canonical.launchpad.interfaces import IDistroArchReleaseSet
19
20
 
20
21
from canonical.launchpad.scripts.builddmaster import BuilddMaster
26
27
_default_lockfile = '/var/lock/buildd-master.lock'
27
28
 
28
29
def doSlaveScan(logger):
29
 
    """Proceed the Slave Scanning Process."""    
30
 
    # XXX cprov 20051019
31
 
    # retrive the user infromation from the config file
32
 
    
 
30
    """Proceed the Slave Scanning Process."""
 
31
 
33
32
    # setup a transaction manager
34
 
    tm = initZopeless(dbuser='fiera')
 
33
    tm = initZopeless(dbuser=config.builddmaster.dbuser)
35
34
 
36
35
    buildMaster = BuilddMaster(logger, tm)
37
36
 
38
37
    logger.info("Setting Builders.")
39
 
    
 
38
 
40
39
    # For every distroarchrelease we can find;
41
40
    # put it into the build master
42
41
    for archrelease in getUtility(IDistroArchReleaseSet):
60
59
    # Now that the slaves are free, ask the buildmaster to calculate
61
60
    # the set of build candiates
62
61
    buildCandidatesSortedByProcessor = buildMaster.sortAndSplitByProcessor()
63
 
    
 
62
 
64
63
    logger.info("Dispatching Jobs.")
65
64
    # Now that we've gathered in all the builds;
66
65
    # dispatch the pending ones
85
84
    try:
86
85
        locker.acquire()
87
86
    except OSError:
88
 
        logger.info("Cannot acquire lock.")
 
87
        log.info("Cannot acquire lock.")
89
88
        sys.exit(1)
90
89
 
91
90
    try: