def purge_pending_jobs(event=None, site=None, queue=None):
 purged_task_count = 0
 for queue in get_queue_list(queue):
  q = get_queue(queue)
  for job in q.jobs:
   if (site and event):
    if ((job.kwargs[u'site'] == site) and (job.kwargs[u'event'] == event)):
     job.delete()
     purged_task_count += 1
   elif site:
    if (job.kwargs[u'site'] == site):
     job.delete()
     purged_task_count += 1
   elif event:
    if (job.kwargs[u'event'] == event):
     job.delete()
     purged_task_count += 1
   else:
    purged_task_count += q.count
    q.empty()
 return purged_task_count

def purge_pending_jobs ( event = None , site = None , queue = None ) : purged_task_count = 0 for queue in get_queue_list ( queue ) : q = get_queue ( queue ) for job in q . jobs : if ( site and event ) : if ( ( job . kwargs [ u'site' ] == site ) and ( job . kwargs [ u'event' ] == event ) ) : job . delete ( ) purged_task_count += 1 elif site : if ( job . kwargs [ u'site' ] == site ) : job . delete ( ) purged_task_count += 1 elif event : if ( job . kwargs [ u'event' ] == event ) : job . delete ( ) purged_task_count += 1 else : purged_task_count += q . count q . empty ( ) return purged_task_count
purge tasks of the event event type .