def add_operation(feed, activities, trim=True, batch_interface=None):
 t = timer()
 msg_format = 'running %s.add_many operation for %s activities batch interface %s and trim %s'
 logger.debug(msg_format, feed, len(activities), batch_interface, trim)
 feed.add_many(activities, batch_interface=batch_interface, trim=trim)
 logger.debug('add many operation took %s seconds', t.next())

def add_operation ( feed , activities , trim = True , batch_interface = None ) : t = timer ( ) msg_format = 'running %s.add_many operation for %s activities batch interface %s and trim %s' logger . debug ( msg_format , feed , len ( activities ) , batch_interface , trim ) feed . add_many ( activities , batch_interface = batch_interface , trim = trim ) logger . debug ( 'add many operation took %s seconds' , t . next ( ) )
add the activities to the feed functions used in tasks need to be at the main level of the module .