~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
8138.1.2 by Jonathan Lange
Run migrater over lp.code. Many tests broken and imports failing.
17
from lp.code.interfaces.branchmergeproposal import (
7675.624.19 by Tim Penhey
Change the merge proposal job cronscript to use the new job source
18
    IBranchMergeProposalJobSource,
19
    )
14612.2.8 by William Grant
cronscripts
20
from lp.services.job.runner import (
21
    JobCronScript,
22
    TwistedJobRunner,
23
    )
7675.624.23 by Tim Penhey
Make the new 'all merge proposal jobs' cronscript use the twisted job runner.
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,
13701.1.2 by Aaron Bentley
Provide log-twisted option if job runner is TwistedJobRunner.
35
            name='merge-proposal-jobs')
36
7628.1.2 by Aaron Bentley
Merge proposal diff generation work-in-progress
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()