__import__ task for --sample

This commit is contained in:
James Turk 2012-05-15 16:54:33 -04:00
parent 66acbde1d8
commit aba52c28a3

View File

@ -25,7 +25,8 @@ def main():
if args.sample:
print 'sampling 100 documents'
docs = docs.limit(100)
task = current_app.tasks[name]
module, name = args.task.rsplit('.', 1)
task = getattr(__import__(module, fromlist=[name]), name)
for doc in docs:
task.apply((doc['_id'],))