Ejemplo n.º 1
0
 def __init__(self,request,domain,cur_queue_name,context,engine,retry_times):
     self.request = request
     self.domain = domain
     self.in_queue = cur_queue_name
     self.context = context
     self.retry_times = retry_times
     self.failure_times = 0
     if not engine:
         import http_client_engine
         self.engine = http_client_engine.get_engine()
     else:
         self.engine = engine
Ejemplo n.º 2
0
    def signal(self, domain):
        import http_client_engine

        engine = http_client_engine.get_engine()
        free_count = engine.get_free_conn(domain)
        if self.__algorithm == "BFS":
            queues = self.__task_queues
        else:
            queues = reversed(self.__task_queues)
        for item in queues:
            while free_count > 0:
                if not item[1].signal(domain):
                    break
                free_count -= 1
        # check if there is no pending request for this manager
        if engine.get_pending_count() == 0 and self.get_count() == 0:
            import controller

            controller.set_state(controller.STATE_FINISHED)