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 |
#
|
14027.3.2
by Jeroen Vermeulen
Merge devel, resolve conflicts. |
3 |
# Copyright 2009-2011 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 |
||
4935.3.7
by Curtis Hovey
Added bad name suppression to cronscripts. |
6 |
# pylint: disable-msg=C0103,W0403
|
2075
by Canonical.com Patch Queue Manager
add better distrorelease translation pages, r=salgado |
7 |
|
8 |
# This script updates the cached stats in the system
|
|
9 |
||
2125
by Canonical.com Patch Queue Manager
[r=bjornt] Cronscript refactorings |
10 |
import _pythonpath |
2075
by Canonical.com Patch Queue Manager
add better distrorelease translation pages, r=salgado |
11 |
from zope.component import getUtility |
14027.3.2
by Jeroen Vermeulen
Merge devel, resolve conflicts. |
12 |
|
14605.1.1
by Curtis Hovey
Moved canonical.config to lp.services. |
13 |
from lp.services.config import config |
14557.1.5
by Curtis Hovey
Simplified names. |
14 |
from lp.services.statistics.interfaces.statistic import ( |
11882.2.2
by Jonathan Lange
Clear up a heck of a lot of imports from canonical.launchpad.interfaces. |
15 |
ILaunchpadStatisticSet, |
16 |
)
|
|
17 |
from lp.registry.interfaces.distribution import IDistributionSet |
|
18 |
from lp.registry.interfaces.person import IPersonSet |
|
14027.3.2
by Jeroen Vermeulen
Merge devel, resolve conflicts. |
19 |
from lp.services.scripts.base import LaunchpadCronScript |
2075
by Canonical.com Patch Queue Manager
add better distrorelease translation pages, r=salgado |
20 |
|
3691.348.18
by kiko
Convert most other scripts; 6 remain, of which one looks like it's going to be a bit tricky... |
21 |
|
4264.2.1
by James Henstridge
add a LaunchpadCronScript subclass, and make cronscripts/*.py use it |
22 |
class StatUpdater(LaunchpadCronScript): |
12415.1.1
by William Grant
Stop using txn.set_isolation_level in scripts... run() has an argument for that purpose. |
23 |
|
3691.348.18
by kiko
Convert most other scripts; 6 remain, of which one looks like it's going to be a bit tricky... |
24 |
def main(self): |
25 |
self.logger.debug('Starting the stats update') |
|
26 |
||
27 |
# Note that we do not issue commits here in the script; content
|
|
28 |
# objects are responsible for committing.
|
|
2075
by Canonical.com Patch Queue Manager
add better distrorelease translation pages, r=salgado |
29 |
distroset = getUtility(IDistributionSet) |
30 |
for distro in distroset: |
|
9760.8.1
by Brad Crittenden
Change the non-English 'serieses' to 'series' throughout our codebase. |
31 |
for distroseries in distro.series: |
4285.2.3
by Mark Shuttleworth
Test fixes for renamed DistroSeries |
32 |
distroseries.updateStatistics(self.txn) |
3691.348.18
by kiko
Convert most other scripts; 6 remain, of which one looks like it's going to be a bit tricky... |
33 |
|
3617.1.2
by Steve Alexander
removed lib/canonical/rosetta, and changed _clearCache to the public API clear_current_connection_cache |
34 |
launchpad_stats = getUtility(ILaunchpadStatisticSet) |
3691.348.18
by kiko
Convert most other scripts; 6 remain, of which one looks like it's going to be a bit tricky... |
35 |
launchpad_stats.updateStatistics(self.txn) |
36 |
||
37 |
getUtility(IPersonSet).updateStatistics(self.txn) |
|
38 |
||
39 |
self.logger.debug('Finished the stats update') |
|
40 |
||
2075
by Canonical.com Patch Queue Manager
add better distrorelease translation pages, r=salgado |
41 |
|
42 |
if __name__ == '__main__': |
|
12415.1.1
by William Grant
Stop using txn.set_isolation_level in scripts... run() has an argument for that purpose. |
43 |
script = StatUpdater('launchpad-stats', dbuser=config.statistician.dbuser) |
14022.3.2
by William Grant
LaunchpadScript no longer uses initZopeless. |
44 |
script.lock_and_run() |