~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to scripts/code-import-worker-monitor.py

  • Committer: Michael Hudson
  • Date: 2010-03-10 05:41:54 UTC
  • mto: This revision was merged to the branch mainline in revision 10510.
  • Revision ID: michael.hudson@canonical.com-20100310054154-ij4hjq1vgsfpmwem
all tests pass, i think

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
from twisted.internet import defer, reactor
24
24
from twisted.python import log
 
25
from twisted.web import xmlrpc
 
26
 
 
27
from canonical.config import config
 
28
from canonical.twistedsupport.loggingsupport import set_up_oops_reporting
25
29
 
26
30
from lp.codehosting.codeimport.workermonitor import (
27
31
    CodeImportWorkerMonitor)
28
32
from lp.services.scripts.base import LaunchpadScript
29
 
from canonical.twistedsupport.loggingsupport import set_up_oops_reporting
30
33
 
31
34
 
32
35
class CodeImportWorker(LaunchpadScript):
35
38
        LaunchpadScript.__init__(self, name, dbuser, test_args)
36
39
        set_up_oops_reporting(name, mangle_stdout=True)
37
40
 
 
41
    def _init_db(self, implicit_begin, isolation):
 
42
        pass
 
43
 
38
44
    def main(self):
39
45
        # XXX: MichaelHudson 2008-05-07 bug=227586: Setting up the component
40
46
        # architecture overrides $GNUPGHOME to something stupid.
49
55
 
50
56
    def _main(self):
51
57
        arg, = self.args
52
 
        return CodeImportWorkerMonitor(int(arg), self.logger).run()
 
58
        worker = CodeImportWorkerMonitor(
 
59
            int(arg), self.logger,
 
60
            xmlrpc.Proxy(config.codeimportdispatcher.codeimportscheduler_url))
 
61
        return worker.run()
53
62
 
54
63
if __name__ == '__main__':
55
 
    script = CodeImportWorker('codeimportworker', dbuser='codeimportworker')
 
64
    script = CodeImportWorker('codeimportworker')
56
65
    script.run()