'Processes the tasks.'

def ProcessTask(self, target, args, name, queueing_time):

    if self.pool.name:
        time_in_queue = (time.time() - queueing_time)
        stats.STATS.RecordEvent((self.pool.name + '_queueing_time'), time_in_queue)
        start_time = time.time()
    try:
        target(*args)
    except Exception as e:
        if self.pool.name:
            stats.STATS.IncrementCounter((self.pool.name + '_task_exceptions'))
        logging.exception('Caught    exception    in    worker    thread    (%s):    %s', name, str(e))
    if self.pool.name:
        total_time = (time.time() - start_time)
        stats.STATS.RecordEvent((self.pool.name + '_working_time'), total_time)
