Exemple #1
0
    def __logFilesWaiter(self, testcase):
        self.stime = time.time()

        print ' **> LogFilesWaiter is waiting, %d, %s, %s' \
            % (self.stime, self.logsReceived, self.peer.ipAddress)

        # FIXME: hack to allow the files to be sent.
        # This disables the protection from the slave
        # failing to send the files.
        while self.stime == None or \
        (time.time() - self.stime < 1800000000000000000000 and \
        not self.logsReceived):
            if self.shuttingDown:
                return
            time.sleep(1)

        print ' **> LogFilesWaiter has stopped waiting, %d, %s, %s, %s, %s' \
            % (time.time() - self.stime, self.stime, self.logsReceived, time.time(), self.peer.ipAddress)
   
        if self.logsReceived and self.REBOOT_PER_TEST:
            print ' **> Rebooting peer as test has completed, %s' % self.peer.ipAddress
            SignalExchangeHub().propagateSignal(PeerReboot(self.peer))
        elif self.logsReceived and not self.REBOOT_PER_TEST:
            print ' **> Test has completed, no need for reboot, %s' % self.peer.ipAddress
            self.peer.setState(ActivePeerState.ACTIVE())
        elif self.logsReceived == False:
            print ' **> Didn\'t receive log files for %s' % self.peer.ipAddress
            SignalExchangeHub().propagateSignal(PeerRecovery(self.peer)) 
            logSig = LogFilesTransfered(self.peer.macAddress, testcase.testId, {}, testcase.iteration)
            logSig.removePeerNamespace()
            SignalExchangeHub().propagateSignal(logSig)
            testcase.state = TestState.SLAVE_CRASH()
        SignalExchangeHub().propagateSignal(
            TestCompleted(self.peer.macAddress, testcase))