Changeset 83341 in vbox for trunk/src/VBox/ValidationKit/testmanager
- Timestamp:
- Mar 19, 2020 8:40:17 PM (5 years ago)
- Location:
- trunk/src/VBox/ValidationKit/testmanager
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/core/schedulerbase.py
r82968 r83341 69 69 # Load data from the database. 70 70 # 71 oSchedGroupLogic = SchedGroupLogic(oDb); 72 self.oSchedGroup = oSchedGroupLogic.cachedLookup(idSchedGroup); 71 73 72 74 # Will extend the entries with aoTestCases and dTestCases members 73 # further down. checkForGroupDepCycles will add aidTestGroupPreReqs. 74 self.aoTestGroups = SchedGroupLogic(oDb).getMembers(idSchedGroup); 75 # further down (SchedGroupMemberDataEx). checkForGroupDepCycles 76 # will add aidTestGroupPreReqs. 77 self.aoTestGroups = oSchedGroupLogic.getMembers(idSchedGroup); 75 78 76 79 # aoTestCases entries are TestCaseData instance with iSchedPriority 77 80 # and idTestGroup added for our purposes. 78 81 # We will add oTestGroup and aoArgsVariations members to each further down. 79 self.aoTestCases = SchedGroupLogic(oDb).getTestCasesForGroup(idSchedGroup, cMax = 4096);82 self.aoTestCases = oSchedGroupLogic.getTestCasesForGroup(idSchedGroup, cMax = 4096); 80 83 81 84 # Load dependencies. … … 87 90 # and idTestGroup added for our purposes. 88 91 # We will add oTestGroup and oTestCase members to each further down. 89 self.aoArgsVariations = SchedGroupLogic(oDb).getTestCaseArgsForGroup(idSchedGroup, cMax = 65536);92 self.aoArgsVariations = oSchedGroupLogic.getTestCaseArgsForGroup(idSchedGroup, cMax = 65536); 90 93 91 94 # … … 262 265 263 266 if oTestGroup.aoTestCases: 264 iTstPrio = oTestGroup.aoTestCases[0] ;267 iTstPrio = oTestGroup.aoTestCases[0].iSchedPriority; 265 268 for iTestCase, oTestCase in enumerate(oTestGroup.aoTestCases): 266 269 if oTestCase.iSchedPriority > iTstPrio: … … 622 625 # 623 626 aoItems = list(); 624 if oData.aoArgsVariations: 627 if not oData.oSchedGroup.fEnabled: 628 self.msgInfo('Disabled.'); 629 elif not oData.aoArgsVariations: 630 self.msgInfo('Found no test case argument variations.'); 631 else: 625 632 aoItems = self._recreateQueueItems(oData); 626 633 self.msgDebug('len(aoItems)=%s' % (len(aoItems),)); … … 635 642 , (self._oSchedGrpData.idSchedGroup,)); 636 643 cItems = self._oDb.fetchOne()[0]; 637 offQueueNew = (offQueue * cItems) / len(aoItems);644 offQueueNew = (offQueue * cItems) // len(aoItems); 638 645 if offQueueNew != 0: 639 646 aoItems = aoItems[offQueueNew:] + aoItems[:offQueueNew]; … … 646 653 self._recreateQueueCancelGatherings(); 647 654 self._oDb.execute('DELETE FROM SchedQueues WHERE idSchedGroup = %s\n', (self._oSchedGrpData.idSchedGroup,)); 648 self._oDb.insertList('INSERT INTO SchedQueues (\n' 649 ' idSchedGroup,\n' 650 ' offQueue,\n' 651 ' idGenTestCaseArgs,\n' 652 ' idTestGroup,\n' 653 ' aidTestGroupPreReqs,\n' 654 ' bmHourlySchedule,\n' 655 ' cMissingGangMembers )\n', 656 aoItems, self._formatItemForInsert); 655 if aoItems: 656 self._oDb.insertList('INSERT INTO SchedQueues (\n' 657 ' idSchedGroup,\n' 658 ' offQueue,\n' 659 ' idGenTestCaseArgs,\n' 660 ' idTestGroup,\n' 661 ' aidTestGroupPreReqs,\n' 662 ' bmHourlySchedule,\n' 663 ' cMissingGangMembers )\n', 664 aoItems, self._formatItemForInsert); 657 665 return (aoErrors, self._asMessages); 658 666 … … 723 731 724 732 733 @staticmethod 734 def cleanUpOrphanedQueues(oDb): 735 """ 736 Removes orphan scheduling queues from the SchedQueues table. 737 738 Queues becomes orphaned when the scheduling group they belongs to has been deleted. 739 740 Returns number of orphaned queues. 741 Raises exception database error. 742 """ 743 cRet = 0; 744 try: 745 oDb.rollback(); 746 oDb.begin(); 747 oDb.execute(''' 748 SELECT SchedQueues.idSchedGroup 749 FROM SchedQueues 750 LEFT OUTER JOIN SchedGroups 751 ON SchedGroups.idSchedGroup = SchedQueues.idSchedGroup 752 AND SchedGroups.tsExpire = 'infinity'::TIMESTAMP 753 WHERE SchedGroups.idSchedGroup is NULL 754 GROUP BY SchedQueues.idSchedGroup'''); 755 aaoOrphanRows = oDb.fetchAll(); 756 cRet = len(aaoOrphanRows); 757 if cRet > 0: 758 oDb.execute('DELETE FROM SchedQueues WHERE idSchedGroup IN (%s)' 759 % (','.join([str(aoRow[0]) for aoRow in aaoOrphanRows]),)); 760 oDb.commit(); 761 except: 762 oDb.rollback(); 763 raise; 764 return cRet; 765 725 766 726 767 # … … 764 805 765 806 cSecTimeout = oTestEx.cSecTimeout if oTestEx.cSecTimeout is not None else oTestEx.oTestCase.cSecTimeout; 766 cSecTimeout = cSecTimeout * oTestBox.pctScaleTimeout / 100;807 cSecTimeout = cSecTimeout * oTestBox.pctScaleTimeout // 100; 767 808 768 809 dResponse = \ … … 871 912 872 913 sBaseFilename = '%04d/%02d/%02d/%02d/TestSet-%s' \ 873 % (tsNow.year, tsNow.month, tsNow.day, (tsNow.hour / 6) * 6, idTestSet);914 % (tsNow.year, tsNow.month, tsNow.day, (tsNow.hour // 6) * 6, idTestSet); 874 915 875 916 # -
trunk/src/VBox/ValidationKit/testmanager/core/schedulerbeci.py
r82968 r83341 57 57 iPrio = oTestCase.iSchedPriority; 58 58 assert iPrio in range(32); 59 iPrio = iPrio / 4;59 iPrio = iPrio // 4; 60 60 assert iPrio in range(8); 61 61 if iPrio > iMaxPriority: -
trunk/src/VBox/ValidationKit/testmanager/webui/wuiadmin.py
r83338 r83341 685 685 else: 686 686 self._sPageBody += '<p>%s. [Cannot link to %s]</p>' \ 687 % (webutils.escapeElem(oError[0]), webutils.escapeElem(str(oError[1])) );687 % (webutils.escapeElem(oError[0]), webutils.escapeElem(str(oError[1])),); 688 688 for sMsg in asMessages: 689 689 self._sPageBody += '<p>%s<p>\n' % (webutils.escapeElem(sMsg),); 690 691 # Remove leftovers from deleted scheduling groups. 692 self._sPageBody += '<h3>Cleanups</h3>\n'; 693 cOrphans = SchedulerBase.cleanUpOrphanedQueues(self._oDb); 694 self._sPageBody += '<p>Removed %s orphaned (deleted) queue%s.<p>\n' % (cOrphans, '' if cOrphans == 1 else 's', ); 690 695 else: 691 696 self._sPageBody = webutils.escapeElem('%s is a read only user and may not regenerate the scheduling queues!'
Note:
See TracChangeset
for help on using the changeset viewer.