Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

25 lines (20 sloc) 0.709 kb
import commonware.log
import cronjobs
from celery.messaging import establish_connection
from celeryutils import chunked
import input
from feedback.models import Opinion
from search import tasks
log = commonware.log.getLogger('i.cron')
def index_all():
This reindexes all the Opinions in usage. This is not intended to be run
other than to initially seed Elastic Search.
ids = (Opinion.objects
.filter(_type__in=[ for i in input.OPINION_USAGE])
.values_list('id', flat=True))
with establish_connection() as conn:
for chunk in chunked(ids, 1000):
tasks.add_to_index.apply_async(args=[chunk], connection=conn)
Jump to Line
Something went wrong with that request. Please try again.