def METHOD_NAME():    
    #ns=Pyro.naming.NameServerLocator().getNS()
    ns = hybrid_ns.getNS()
    #tq = Pyro.core.getProxyForURI("PYRONAME://" + taskQueueName)
    procName = compName + ' - PID:%d' % os.getpid()
    import logging
    logging.basicConfig(filename='taskWorkerZC_%d.log' % os.getpid(), level=logging.INFO)
    logger = logging.getLogger(__file__)
    serverFails = {}
    #loop forever asking for tasks
    while 1:
        queueNames = ns.list('TaskQueues')
        #print queueNames
        tasks = []
        #loop over all queues, looking for tasks to process
        while len(tasks) == 0 and len(queueNames) > 0:
            #try queue on current machine first
            #print queueNames
            if compName in queueNames:
                qName = compName
                queueNames.remove(qName)
            else: #pick a queue at random
                qName = queueNames.pop(random.randint(0, len(queueNames)-1))
            try:
                #print qName
                tq = Pyro.core.getProxyForURI(ns.resolve(qName))
                tq._setTimeout(10)
                tq._setOneway(['returnCompletedTask'])
                #print qName
                #ask the queue for tasks
                logging.debug('Getting tasks from server')
                tasks = tq.getTasks(procName, PYME.version.version)
                logging.debug('Got %d tasks' % len(tasks))
                #we succesfully contacted the server, so reset it's fail count
                serverFails[qName] = 0
            except Pyro.core.ProtocolError as e:
                logging.exception('Pyro error: %s' %e.message)
                if e.message == 'connection failed':
                    #remember that the server failed - and put it 'on notice'
                    nFails = 1
                    if qName in serverFails.keys():
                        nFails += serverFails[qName]
                    serverFails[qName] = nFails
                    if False:#nFails >= 4:
                        #server is dead in the water - put it out of it's misery
                        print(('Killing:', qName))
                        try:
                            ns.unregister('TaskQueues.%s' % qName)
                        except Pyro.errors.NamingError:
                            pass
            except Exception:
                import traceback
                logger.exception(traceback.format_exc())
                #pass
        if len(tasks) == 0: #no queues had tasks
            logger.debug('No tasks avaialable, waiting')
            time.sleep(1) #put ourselves to sleep to avoid constant polling
        #else:
        #    print qName, len(tasks)
        #results = []
        #loop over tasks - we pop each task and then delete it after processing
        #to keep memory usage down
        while len(tasks) > 0:
            #get the next task (a task is a function, or more generally, a class with
            #a __call__ method
            task = tasks.pop(0)
            try:
                #execute the task,
                t1 = time.time()
                logger.debug('running task')
                res = task(taskQueue=tq)
                t2 = time.time()
                if not task.resultsURI is None:
                    # new style way of returning results to reduce load on server
                    from PYME.IO import clusterResults
                    clusterResults.fileResults(task.resultsURI, res)
                logging.debug('Returning task for frame %d' % res.index)
                tq.returnCompletedTask(res, procName, t2-t1)
            except:
                import traceback
                logger.exception('Error returning results')
                traceback.print_exc()
            del task
        #tq.returnCompletedTasks(results, name)
        del tasks
        #del results