def _runExecThreads(self, execThreads, minProgress, maxProgress):
        """ run exec threads """
        if (len(execThreads) == 0):
            self._updateProgress(maxProgress)
            return
        
        # start with min progress
        self._updateProgress(minProgress)

        # now wait for the threads to complete and update progress
        while (True):
            self._checkStop()

            progress = 0
            running = False

            for execThread in execThreads:
                
                self.extendTimeout(execThread.getTimeout())
                status = AgentThread._runExeThread(self, execThread)

                progress += status['progress']

            if (not running):
                break

            # update the progress
            percent = progress / len(execThreads)

            self._updateProgress(calcProgress(minProgress, maxProgress, float(percent) / 100))

            time.sleep(float(pylons.config['exec_thread_sleep_time']))

        self._updateProgress(maxProgress)
Beispiel #2
0
    def _runExecThreads(self, execThreads, minProgress, maxProgress):
        """ run exec threads """
        if (len(execThreads) == 0):
            self._updateProgress(maxProgress)
            return

        # start with min progress
        self._updateProgress(minProgress)

        # now wait for the threads to complete and update progress
        firstTime = True
        while (True):
            self._checkStop()

            progress = 0
            running = False

            for (execThread, dummy) in execThreads:
                #first time, push recovery stack
                if firstTime:
                    self._pushRecStack(execThread.getCmd())

                if dummy:
                    continue

                self.extendTimeout(execThread.getTimeout())
                status = AgentThread._runExeThread(self, (execThread, dummy))

                progress += status['progress']

            firstTime = False

            if (not running):
                break

            # update the progress
            percent = progress / len(execThreads)

            self._updateProgress(
                calcProgress(minProgress, maxProgress,
                             float(percent) / 100))

            time.sleep(float(pylons.config['exec_thread_sleep_time']))

        self._updateProgress(maxProgress)
    def _runExecThreads(self, execThreads, minProgress, maxProgress):
        """ run exec threads """
        if (len(execThreads) == 0):
            self._updateProgress(maxProgress)
            return

        # start with min progress
        self._updateProgress(minProgress)

        # now wait for the threads to complete and update progress
        firstTime = True
        while (True):
            self._checkStop()

            progress = 0
            running = False

            for (execThread, dummy) in execThreads:
                #first time, push recovery stack
                if firstTime:
                    self._pushRecStack(execThread.getCmd())
                
                if dummy:
                    continue
                
                self.extendTimeout(execThread.getTimeout())
                status = AgentThread._runExeThread(self, (execThread, dummy))

                progress += status['progress']

            firstTime = False

            if (not running):
                break

            # update the progress
            percent = progress / len(execThreads)

            self._updateProgress(calcProgress(minProgress, maxProgress, float(percent) / 100))

            time.sleep(float(pylons.config['exec_thread_sleep_time']))

        self._updateProgress(maxProgress)