~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
#
3
# Copyright 2009 Canonical Ltd.  This software is licensed under the
4
# GNU Affero General Public License version 3 (see the file LICENSE).
5
9678.4.39 by Barry Warsaw
[rs=gary] Fix the test_all_scripts failures by making sure apport_python_hook
6
"""Cron job to update Product.remote_product using bug watch information.  """
7
7793.5.18 by Bjorn Tillenius
Fix lint warnings.
8
# pylint: disable-msg=W0403
9678.4.39 by Barry Warsaw
[rs=gary] Fix the test_all_scripts failures by making sure apport_python_hook
9
import _pythonpath
7793.5.13 by Bjorn Tillenius
Add a cronscript for updating the remote_product.
10
11
import time
12
13
from canonical.config import config
8356.1.1 by Leonard Richardson
Partial move.
14
from lp.services.scripts.base import LaunchpadCronScript
7793.5.13 by Bjorn Tillenius
Add a cronscript for updating the remote_product.
15
from canonical.launchpad.scripts.updateremoteproduct import (
16
    RemoteProductUpdater)
17
18
19
class UpdateRemoteProduct(LaunchpadCronScript):
20
21
    def main(self):
22
        start_time = time.time()
23
7793.5.14 by Bjorn Tillenius
Add logging to show that the script actually does the right thing.
24
        updater = RemoteProductUpdater(self.txn, self.logger)
7793.5.13 by Bjorn Tillenius
Add a cronscript for updating the remote_product.
25
        updater.update()
26
27
        run_time = time.time() - start_time
28
        self.logger.info("Time for this run: %.3f seconds." % run_time)
29
30
31
if __name__ == '__main__':
32
    script = UpdateRemoteProduct(
33
        "updateremoteproduct", dbuser=config.updateremoteproduct.dbuser)
34
    script.lock_and_run()