Esempio n. 1
0
 def wait_release(self):
     """
     To wait free place in stack
     """
     try:
         waiting_for(self.is_release, timeout=self.release_timeout, sleep=0.001)
     except TimeoutException:
         raise TimeoutException(
             'Process list have not been release for "{}" sec.'.format(self.release_timeout),
         )
    def serve(self):
        while not self._queue.empty():
            try:
                waiting_for(self._is_release, timeout=self._process_timeout, sleep=0.01)
            except TimeoutException:
                self.destroy()
                raise

            target, args, kwargs = self._queue.get_nowait()
            process = Process(target=target, args=args, kwargs=kwargs)
            process.start()
            self._current.append(process)