#NEWLINE# def create_fanout_tasks( self , follower_ids , feed_class , operation , operation_kwargs = None , fanout_priority = None ) : #NEWLINE# #INDENT# '\n        Creates the fanout task for the given activities and feed classes\n        followers\n\n        It takes the following ids and distributes them per fanout_chunk_size\n        into smaller tasks\n\n        :param follower_ids: specify the list of followers\n        :param feed_class: the feed classes to run the operation on\n        :param operation: the operation function applied to all follower feeds\n        :param operation_kwargs: kwargs passed to the operation\n        :param fanout_priority: the priority set to this fanout\n        ' #NEWLINE# fanout_task = self . get_fanout_task ( fanout_priority , feed_class = feed_class ) #NEWLINE# if ( not fanout_task ) : #NEWLINE# #INDENT# return [ ] #NEWLINE# #UNINDENT# chunk_size = self . fanout_chunk_size #NEWLINE# user_ids_chunks = list ( chunks ( follower_ids , chunk_size ) ) #NEWLINE# msg_format = 'spawning %s subtasks for %s user ids in chunks of %s users' #NEWLINE# logger . info ( msg_format , len ( user_ids_chunks ) , len ( follower_ids ) , chunk_size ) #NEWLINE# tasks = [ ] #NEWLINE# for ids_chunk in user_ids_chunks : #NEWLINE# #INDENT# task = fanout_task . delay ( feed_manager = self , feed_class = user_ids_chunks , user_ids = ids_chunk , operation = operation , operation_kwargs = operation_kwargs ) #NEWLINE# tasks . append ( task ) #NEWLINE# #UNINDENT# return tasks