~launchpad-pqm/launchpad/devel

3944.1.1 by Francis J. Lacoste
Use system version python2.4 for scripts.
1
#!/usr/bin/python2.4
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
2
"""
3
Cron job to run daily to check all of the BugWatches
4
"""
5
4813.6.1 by Graham Binns
Added default_socket_timeout key to checkwatches config section.
6
import socket
4813.6.2 by Graham Binns
Added timeouts and logging to checkwatches.
7
import time
2125 by Canonical.com Patch Queue Manager
[r=bjornt] Cronscript refactorings
8
import _pythonpath
1752 by Canonical.com Patch Queue Manager
[r=jamesh] Ensure checkwatches.py does locking and some updates to current standards.
9
3048.4.6 by Bjorn Tillenius
make cronscript use ExternalSystem.updateBugWatches(...)
10
from zope.component import getUtility
11
4813.6.1 by Graham Binns
Added default_socket_timeout key to checkwatches config section.
12
from canonical.config import config
4264.2.1 by James Henstridge
add a LaunchpadCronScript subclass, and make cronscripts/*.py use it
13
from canonical.launchpad.scripts.base import LaunchpadCronScript
4813.6.5 by Graham Binns
Refactored checkwatches cronscript into something far tidier and more attractive.
14
from canonical.launchpad.scripts.checkwatches import BugWatchUpdater
3691.348.13 by kiko
Convert a couple of cronscripts over to LaunchpadScript
15
4264.2.1 by James Henstridge
add a LaunchpadCronScript subclass, and make cronscripts/*.py use it
16
class CheckWatches(LaunchpadCronScript):
3691.348.13 by kiko
Convert a couple of cronscripts over to LaunchpadScript
17
    def main(self):
4813.6.2 by Graham Binns
Added timeouts and logging to checkwatches.
18
        start_time = time.time()
4813.6.5 by Graham Binns
Refactored checkwatches cronscript into something far tidier and more attractive.
19
20
        updater = BugWatchUpdater(self.txn, self.logger)
21
        updater.updateBugTrackers()
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
22
4813.6.2 by Graham Binns
Added timeouts and logging to checkwatches.
23
        run_time = time.time() - start_time
4813.6.3 by Graham Binns
Added timeout error handling.
24
        self.logger.info("Time for this run: %.3f seconds." %
4813.6.2 by Graham Binns
Added timeouts and logging to checkwatches.
25
            run_time)
26
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
27
if __name__ == '__main__':
3691.348.13 by kiko
Convert a couple of cronscripts over to LaunchpadScript
28
    script = CheckWatches("checkwatches")
29
    script.lock_and_run()
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
30