#NEWLINE# def insert_tasks_ignore_duplicate_names( tasks , queue , * args , **kwargs ) : #NEWLINE# #INDENT# 'Insert a batch of tasks into a specific queue.  If a\n    DuplicateTaskNameError is raised, loop through the tasks and insert the\n    remaining, ignoring and logging the duplicate tasks.\n\n    Returns the number of successfully inserted tasks.\n    ' #NEWLINE# from google.appengine.api import taskqueue #NEWLINE# try : #NEWLINE# #INDENT# inserted = _insert_tasks ( tasks , queue , * args , ** kwargs ) #NEWLINE# return inserted #NEWLINE# #UNINDENT# except taskqueue . DuplicateTaskNameError : #NEWLINE# #INDENT# reinsert = _tasks_to_reinsert ( tasks , transactional = False ) #NEWLINE# count = len ( reinsert ) #NEWLINE# inserted = ( len ( tasks ) - count ) #NEWLINE# for task in args : #NEWLINE# #INDENT# inserted += _insert_tasks ( [ task ] , queue , * args , ** kwargs ) #NEWLINE# #UNINDENT# return inserted