~launchpad-pqm/launchpad/devel

10637.3.1 by Guilherme Salgado
Use the default python version instead of a hard-coded version
1
#!/usr/bin/python -S
8687.15.7 by Karl Fogel
Add the copyright header block to more files.
2
#
7675.624.17 by Tim Penhey
Renamed to merge-proposal-jobs now that it does the update diff job as well.
3
# Copyright 2009, 2010 Canonical Ltd.  This software is licensed under the
8687.15.7 by Karl Fogel
Add the copyright header block to more files.
4
# GNU Affero General Public License version 3 (see the file LICENSE).
5
7628.1.2 by Aaron Bentley
Merge proposal diff generation work-in-progress
6
# pylint: disable-msg=W0403
7
7675.624.17 by Tim Penhey
Renamed to merge-proposal-jobs now that it does the update diff job as well.
8
"""Handle jobs for BranchMergeProposals.
7628.1.2 by Aaron Bentley
Merge proposal diff generation work-in-progress
9
7675.624.17 by Tim Penhey
Renamed to merge-proposal-jobs now that it does the update diff job as well.
10
This script handles all job types for branch merge proposals.
7628.1.2 by Aaron Bentley
Merge proposal diff generation work-in-progress
11
"""
12
13
__metaclass__ = type
14
15
import _pythonpath
16
7675.624.39 by Tim Penhey
A horrible hack to avoid import errors.
17
# The following line is a horrible hack, but unfortunately necessary right now
18
# to stop import errors from circular imports.
19
import canonical.launchpad.interfaces
8138.1.2 by Jonathan Lange
Run migrater over lp.code. Many tests broken and imports failing.
20
from lp.code.interfaces.branchmergeproposal import (
7675.624.19 by Tim Penhey
Change the merge proposal job cronscript to use the new job source
21
    IBranchMergeProposalJobSource,
22
    )
7675.624.23 by Tim Penhey
Make the new 'all merge proposal jobs' cronscript use the twisted job runner.
23
from lp.services.job.runner import JobCronScript, TwistedJobRunner
24
25
26
class RunMergeProposalJobs(JobCronScript):
27
    """Run all merge proposal jobs."""
28
29
    config_name = 'merge_proposal_jobs'
30
    source_interface = IBranchMergeProposalJobSource
31
32
    def __init__(self):
33
        super(RunMergeProposalJobs, self).__init__(
34
            runner_class=TwistedJobRunner,
7675.845.33 by Edwin Grubbs
Fixed tests.
35
            name='merge-proposal-jobs')
7628.1.2 by Aaron Bentley
Merge proposal diff generation work-in-progress
36
37
38
if __name__ == '__main__':
7675.624.23 by Tim Penhey
Make the new 'all merge proposal jobs' cronscript use the twisted job runner.
39
    script = RunMergeProposalJobs()
7628.1.2 by Aaron Bentley
Merge proposal diff generation work-in-progress
40
    script.lock_and_run()