r81076 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81075‎ | r81076 | r81077 >
Date:00:39, 27 January 2011
Author:diederik
Status:deferred
Tags:
Comment:
The simple task scheduler is working now as well and remove some outdated properties from the Settings class.
Modified paths:
  • /trunk/tools/editor_trends/configuration.py (modified) (history)
  • /trunk/tools/editor_trends/cronjobs.py (modified) (history)
  • /trunk/tools/editor_trends/manage.py (modified) (history)

Diff [purge]

Index: trunk/tools/editor_trends/manage.py
@@ -191,6 +191,7 @@
192192 stopwatch = timer.Timer()
193193 log.log_to_mongo(properties, 'dataset', 'export', stopwatch, event='start')
194194
 195+ collection = '%s_%s' % (properties.collection, 'dataset')
195196 for target in properties.targets:
196197 # write_message_to_log(logger, settings,
197198 # message=None,
@@ -198,8 +199,9 @@
199200 # target=target,
200201 # dbname=properties.full_project,
201202 # collection=properties.collection)
 203+
202204 analyzer.generate_chart_data(properties.project.name,
203 - properties.collection,
 205+ collection,
204206 properties.language.code,
205207 target,
206208 **properties.keywords)
@@ -252,7 +254,7 @@
253255 (sort_launcher, 'sort'),
254256 (store_launcher, 'store'),
255257 (transformer_launcher, 'transform'),
256 - (exporter_launcher, 'export')))
 258+ (dataset_launcher, 'dataset')))
257259
258260 for function, callname in functions.iteritems():
259261 if callname not in properties.ignore:
@@ -299,7 +301,7 @@
300302 action='store',
301303 help='Enter the first letter of a language to see which languages are \
302304 available.')
303 - parser_languages.set_defaults(func=show_languages)
 305+ parser_languages.set_defaults(func=language.show_languages(settings, project))
304306
305307 #CONFIG
306308 parser_config = subparsers.add_parser('config',
Index: trunk/tools/editor_trends/configuration.py
@@ -64,11 +64,9 @@
6565 class Settings:
6666 __metaclass__ = Singleton
6767
68 - def __init__(self, debug=True, process_multiplier=1, **kwargs):
 68+ def __init__(self, process_multiplier=1, **kwargs):
6969 self.minimum_python_version = (2, 6)
7070 self.detect_python_version()
71 - self.debug = debug
72 - self.progressbar = True
7371 self.encoding = 'utf-8'
7472
7573 #Date format as used by Erik Zachte
@@ -98,11 +96,10 @@
9997 self.max_filehandles = self.determine_max_filehandles_open()
10098 self.tab_width = 4 if self.platform == 'Windows' else 8
10199
102 - self.load_configuration()
103 - self.set_custom_settings(**kwargs)
104100
105101
106102 self.input_location = os.path.join(self.root, 'wikimedia')
 103+ self.load_configuration()
107104 # Default Input file
108105 self.input_filename = os.path.join(self.input_location, 'en',
109106 'wiki',
@@ -115,8 +112,7 @@
116113 self.dataset_location = os.path.join(self.working_directory, 'datasets')
117114 self.binary_location = os.path.join(self.working_directory,
118115 'data', 'objects')
119 - self.namespace_location = os.path.join(self.working_directory,
120 - 'namespaces')
 116+
121117 self.chart_location = os.path.join(self.working_directory, 'statistics',
122118 'charts')
123119 self.file_choices = ('stub-meta-history.xml.gz',
@@ -124,10 +120,6 @@
125121 'pages-meta-history.xml.7z',
126122 'pages-meta-current.xml.bz2',)
127123
128 - def set_custom_settings(self, **kwargs):
129 - for kw in kwargs:
130 - setattr(self, kw, kwargs[kw])
131 -
132124 def load_configuration(self):
133125 if os.path.exists(os.path.join(self.working_directory, 'wiki.cfg')):
134126 config = ConfigParser.RawConfigParser()
@@ -157,10 +149,10 @@
158150 return platform.system()
159151
160152 def verify_environment(self, directories):
161 - for dir in directories:
162 - if not os.path.exists(dir):
 153+ for directory in directories:
 154+ if not os.path.exists(directory):
163155 try:
164 - os.makedirs(dir)
 156+ os.makedirs(directory)
165157 except IOError:
166158 raise 'Configuration Error, could not create directory.'
167159
Index: trunk/tools/editor_trends/cronjobs.py
@@ -17,6 +17,7 @@
1818 __date__ = '2010-10-21'
1919 __version__ = '0.1'
2020
 21+import time
2122 from multiprocessing import Process
2223
2324 import manage as manager
@@ -107,5 +108,8 @@
108109 launcher()
109110
110111
 112+
111113 if __name__ == '__main__':
112 - debug()
 114+ while True:
 115+ launcher()
 116+ time.sleep(5 * 60)

Status & tagging log