def generate_tasks(**kwargs):
 tasks = _local_tasks()
 for (fun, args) in tasks:
  fun(*args)
 tasks.clear()

def generate_tasks ( ** kwargs ) : tasks = _local_tasks ( ) for ( fun , args ) in tasks : fun ( * args ) tasks . clear ( )
goes through thread local index update tasks set and generates celery tasks for all tasks in the set .