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))
def __init__(self, peer, fServiceHost, fServicePort): self.logger = LogManager().getLogger(self.__class__.__name__) self.peer = peer self.beatCounter = 0 self.fServiceHost = fServiceHost self.fServicePort = fServicePort self.reset() self.sLock = threading.RLock() self.__gatherTestLogs = False self.waiterThread = None self.stime = None self.shuttingDown = False exc = ConfigurationManager().getConfiguration("execution") self.__rebootPeer = exc.configuration.rebootNewBoxes.PCDATA == "true" self.REBOOT_PER_TEST = exc.configuration.rebootPerTest.PCDATA == "true" SignalExchangeHub().addListener(CheckPeerState.createListener(self.__checkState)) SignalExchangeHub().addListener(PeerHeartBeat.createListener(self.__heartBeat, self.peer.macAddress)) SignalExchangeHub().addListener(PeerTestState.createListener(self.__testState, peer.macAddress)) SignalExchangeHub().addListener( ExpectReboot.createListener(self.__expectReboot, namespace="*.%s" % peer.macAddress) ) SignalExchangeHub().addListener(LogFilesTransfered.createListener(self.__logFilesReceived, namespace="*")) SignalExchangeHub().addListener( FileServiceStateUpdate.createListener(self.__fileServiceStateUpdate, peer.ipAddress) )