All pastes #205289 Raw Edit

Casanova

public text v1 · immutable
#205289 ·published 2006-10-16 18:21 UTC
rendered paste body
import sys, os, time
import threading

class Evaluator (threading.thread):
    """ The Evaluator will evaluate and update the status """
    def __init__(self):
        pass


    def queue_not_empty (self):
        """ Checks if the ToBeEvaluated queue is empty or not """
        pass

    def dequeue_attempts (self):
        """ Returns an attempt from the ToBeEvaluated queue based on priority
        algorithms or return None if queue is empty """
        pass
    
    def get_attempt (self):
        """ Keep polling the ToBeEvaluated queue until an attempt to be
        evaluated is obtained """
        while True:
            if (self.queue_not_empty()):
                return self.dequeue_attempts()
            time.sleep (1)
            
    def run (self):
        print 'Evaluator Started'
        while True:
            attempt = self.get_attempt ()
            if attempt == None:
                continue
            # evalute the attempt