author | Lennard de Rijk <ljvderijk@gmail.com> |
Wed, 01 Apr 2009 17:23:49 +0000 | |
changeset 2050 | b3b235acdc6e |
parent 2047 | 7e9656691c8e |
child 2052 | a723a2509e21 |
permissions | -rw-r--r-- |
2047
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
2 |
# |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
3 |
# Copyright 2009 the Melange authors. |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
4 |
# |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
8 |
# |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
10 |
# |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
16 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
17 |
"""Starts an interactive shell with statistic helpers. |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
18 |
""" |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
19 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
20 |
__authors__ = [ |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
21 |
'"Sverre Rabbelier" <sverre@rabbelier.nl>', |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
22 |
] |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
23 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
24 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
25 |
import cPickle |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
26 |
import operator |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
27 |
import sys |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
28 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
29 |
import interactive |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
30 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
31 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
32 |
def addKey(target, fieldname): |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
33 |
"""Adds the key of the specified field. |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
34 |
""" |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
35 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
36 |
result = target.copy() |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
37 |
result['%s_key' % fieldname] = target[fieldname].key().name() |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
38 |
return result |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
39 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
40 |
def getOrgs(): |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
41 |
"""Returns all orgs as dictionary. |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
42 |
""" |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
43 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
44 |
from soc.models.organization import Organization |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
45 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
46 |
gen = lambda: Organization.all() |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
47 |
it = interactive.deepFetch(gen) |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
48 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
49 |
orgs = [(i.key().name(), i) for i in it] |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
50 |
return dict(orgs) |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
51 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
52 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
53 |
def getProps(): |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
54 |
"""Returns all proposals as a list of dictionaries. |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
55 |
""" |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
56 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
57 |
key_order = [ |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
58 |
'link_id', 'scope_path', 'title', 'abstract', 'content', |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
59 |
'additional_info', 'mentor', 'possible_mentors', 'score', |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
60 |
'status', 'org'] |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
61 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
62 |
from soc.models.student_proposal import StudentProposal |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
63 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
64 |
gen = lambda: StudentProposal.all() |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
65 |
it = interactive.deepFetch(gen) |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
66 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
67 |
proposals = [i.toDict(key_order) for i in it] |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
68 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
69 |
return proposals |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
70 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
71 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
72 |
def orgstats(target): |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
73 |
"""Retrieves org stats. |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
74 |
""" |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
75 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
76 |
from soc.logic import dicts |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
77 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
78 |
target = [addKey(i, 'org') for i in target] |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
79 |
grouped = dicts.groupby(target, 'org_key') |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
80 |
popularity = [(k, len(v)) for k,v in grouped.iteritems()] |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
81 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
82 |
return grouped, dict(popularity) |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
83 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
84 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
85 |
def printPopularity(popularity): |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
86 |
"""Prints the popularity for the specified proposals. |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
87 |
""" |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
88 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
89 |
g = operator.itemgetter(1) |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
90 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
91 |
for item in sorted(popularity.iteritems(), key=g, reverse=True): |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
92 |
print "%s: %d" % item |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
93 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
94 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
95 |
def savePopularity(popularities): |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
96 |
"""Saves the specified popularities. |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
97 |
""" |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
98 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
99 |
import logging |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
100 |
from google.appengine.ext import db |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
101 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
102 |
from soc.models.organization import Organization |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
103 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
104 |
def txn(key_name, popularity): |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
105 |
org = Organization.get_by_key_name(key_name) |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
106 |
org.nr_applications = popularity |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
107 |
org.put() |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
108 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
109 |
for key, value in sorted(popularities.iteritems()): |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
110 |
print key |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
111 |
db.run_in_transaction_custom_retries(10, txn, key, value) |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
112 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
113 |
print "done" |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
114 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
115 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
116 |
def loadPickle(name): |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
117 |
"""Loads a pickle. |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
118 |
""" |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
119 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
120 |
f = open(name + '.dat') |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
121 |
return cPickle.load(f) |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
122 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
123 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
124 |
def dumpPickle(target, name): |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
125 |
"""Dumps a pickle" |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
126 |
""" |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
127 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
128 |
f = open("%s.dat" % name, 'w') |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
129 |
cPickle.dump(target, f) |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
130 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
131 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
132 |
def main(args): |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
133 |
"""Main routine. |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
134 |
""" |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
135 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
136 |
interactive.setup() |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
137 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
138 |
context = { |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
139 |
'load': loadPickle, |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
140 |
'dump': dumpPickle, |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
141 |
'orgstats': orgstats, |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
142 |
'printPopularity': printPopularity, |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
143 |
'savePopularity': savePopularity, |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
144 |
'getOrgs': getOrgs, |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
145 |
'getProps': getProps, |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
146 |
} |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
147 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
148 |
interactive.remote(args, context) |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
149 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
150 |
if __name__ == '__main__': |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
151 |
if len(sys.argv) < 2: |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
152 |
print "Usage: %s app_id [host]" % (sys.argv[0],) |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
153 |
sys.exit(1) |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
154 |
|
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
155 |
main(sys.argv[1:]) |
7e9656691c8e
Added a stats module to scripts
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
156 |