@task()
@timeit
def index_task(cls, id_list, **kw):
 statsd.incr(('search.tasks.index_task.%s' % cls.get_mapping_type_name()))
 try:
  pin_this_thread()
  qs = cls.get_model().objects.filter(pk__in=id_list).values_list('pk', flat=True)
  for id_ in qs:
   try:
    cls.index(cls.extract_document(id_), id_=id_)
   except UnindexMeBro:
    cls.unindex(id_)
 except Exception as exc:
  retries = index_task.request.retries
  if (retries >= MAX_RETRIES):
   raise IndexingTaskError()
  statsd.incr('search.tasks.index_task.retry', 1)
  statsd.incr(('search.tasks.index_task.retry%d' % RETRY_TIMES[retries]), 1)
  index_task.retry(exc=exc, max_retries=MAX_RETRIES, countdown=RETRY_TIMES[retries])
 finally:
  unpin_this_thread()

@ task ( ) @ timeit def index_task ( cls , id_list , ** kw ) : statsd . incr ( ( 'search.tasks.index_task.%s' % cls . get_mapping_type_name ( ) ) ) try : pin_this_thread ( ) qs = cls . get_model ( ) . objects . filter ( pk__in = id_list ) . values_list ( 'pk' , flat = True ) for id_ in qs : try : cls . index ( cls . extract_document ( id_ ) , id_ = id_ ) except UnindexMeBro : cls . unindex ( id_ ) except Exception as exc : retries = index_task . request . retries if ( retries >= MAX_RETRIES ) : raise IndexingTaskError ( ) statsd . incr ( 'search.tasks.index_task.retry' , 1 ) statsd . incr ( ( 'search.tasks.index_task.retry%d' % RETRY_TIMES [ retries ] ) , 1 ) index_task . retry ( exc = exc , max_retries = MAX_RETRIES , countdown = RETRY_TIMES [ retries ] ) finally : unpin_this_thread ( )
index documents specified by cls and ids .