Index: trunk/tools/editor_trends/manage.py |
— | — | @@ -336,7 +336,7 @@ |
337 | 337 | stopwatch = timer.Timer() |
338 | 338 | log.to_db(rts, 'dataset', 'transform', stopwatch, event='start') |
339 | 339 | log.to_csv(logger, rts, 'Start', 'Transform', transformer_launcher) |
340 | | - transformer.transform_editors_multi_launcher(rts) |
| 340 | + transformer.transform_editors_single_launcher(rts) |
341 | 341 | stopwatch.elapsed() |
342 | 342 | log.to_db(rts, 'dataset', 'transform', stopwatch, event='finish') |
343 | 343 | log.to_csv(logger, rts, 'Finish', 'Transform', transformer_launcher) |
Index: trunk/tools/editor_trends/etl/transformer.py |
— | — | @@ -48,16 +48,15 @@ |
49 | 49 | |
50 | 50 | |
51 | 51 | class Editor: |
52 | | - def __init__(self, rts, editor_id): |
| 52 | + def __init__(self, db_raw, db_dataset, editor_id): |
53 | 53 | self.editor_id = editor_id |
54 | | - self.rts = rts |
| 54 | + self.db_raw = db_raw #storage.init_database(self.rts.storage, self.rts.dbname, self.rts.editors_raw) |
| 55 | + self.db_dataset = db_dataset #storage.init_database(self.rts.storage, self.rts.dbname, self.rts.editors_dataset) |
55 | 56 | |
56 | 57 | def __str__(self): |
57 | 58 | return '%s' % (self.editor_id) |
58 | 59 | |
59 | 60 | def __call__(self): |
60 | | - self.db_raw = storage.init_database(self.rts.storage, self.rts.dbname, self.rts.editors_raw) |
61 | | - self.db_dataset = storage.init_database(self.rts.storage, self.rts.dbname, self.rts.editors_dataset) |
62 | 61 | cutoff = 9 |
63 | 62 | editor = self.db_raw.find_one('editor', self.editor_id) |
64 | 63 | if editor == None: |
— | — | @@ -325,10 +324,10 @@ |
326 | 325 | |
327 | 326 | def transform_editors_single_launcher(rts): |
328 | 327 | print rts.dbname, rts.editors_raw |
329 | | - input_db, output_db, editors = setup_database(rts) |
| 328 | + db_raw, db_dataset, editors = setup_database(rts) |
330 | 329 | pbar = progressbar.ProgressBar(maxval=len(editors)).start() |
331 | 330 | for editor in editors: |
332 | | - editor = Editor(editor, input_db, output_db) |
| 331 | + editor = Editor(db_raw, db_dataset, editor) |
333 | 332 | editor() |
334 | 333 | pbar.update(pbar.currval + 1) |
335 | 334 | |