Created
March 12, 2015 14:22
-
-
Save jdunne-kaplan/bc6a2ee667ec27209fb9 to your computer and use it in GitHub Desktop.
Rebuild TLE index for session
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import models | |
from lib.utils import AsyncBatchUpdateManager | |
from lib.utils import QueryBatchIterator | |
session = models.DBSession.get_by_key_name("4c80b95e-5554-4dfb-8807-839d7851ab36") | |
print session.is_versioned | |
print "" | |
tles = models.TimelineEvent.query_unversioned(session) | |
mgr = AsyncBatchUpdateManager(batch_size=100) | |
updcount = 0 | |
def clean_action(tle): | |
global updcount | |
tle = tle.puttable() | |
mgr.put(tle) | |
updcount += 1 | |
QueryBatchIterator.iterate(tles, 100, clean_action) | |
mgr.complete() | |
print updcount | |
print "" | |
print mgr.has_errors() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment