Пример #1
0
    def _doGangGatheringTimedOut(self, oDb, oStatusData):
        """
        _doRequestCommand worker for handling a box in gang-gathering-timed-out state.
        This will do clean-ups similar to _cleanupOldTest and update the state likewise.
        """
        oDb.begin()

        TestSetLogic(oDb).completeAsGangGatheringTimeout(oStatusData.idTestSet,
                                                         fCommit=False)
        GlobalResourceLogic(oDb).freeGlobalResourcesByTestBox(self._idTestBox,
                                                              fCommit=False)
        TestBoxStatusLogic(oDb).updateState(
            self._idTestBox,
            TestBoxStatusData.ksTestBoxState_Idle,
            fCommit=False)

        oStatusData.tsUpdated = oDb.getCurrentTimestamp()
        oStatusData.enmState = TestBoxStatusData.ksTestBoxState_Idle

        oDb.commit()
        return None
    def _doGangCleanup(self, oDb, oStatusData):
        """
        _doRequestCommand worker for handling a box in gang-cleanup.
        This will check if all testboxes has completed their run, pretending to
        be busy until that happens.  Once all are completed, resources will be
        freed and the testbox returns to idle state (we update oStatusData).
        """
        oStatusLogic = TestBoxStatusLogic(oDb)
        oTestSet = TestSetData().initFromDbWithId(oDb, oStatusData.idTestSet)
        if oStatusLogic.isWholeGangDoneTesting(oTestSet.idTestSetGangLeader):
            oDb.begin()

            GlobalResourceLogic(oDb).freeGlobalResourcesByTestBox(
                self._idTestBox, fCommit=False)
            TestBoxStatusLogic(oDb).updateState(
                self._idTestBox,
                TestBoxStatusData.ksTestBoxState_Idle,
                fCommit=False)

            oStatusData.tsUpdated = oDb.getCurrentTimestamp()
            oStatusData.enmState = TestBoxStatusData.ksTestBoxState_Idle

            oDb.commit()
        return None