VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/testmanager/core/schedulerbeci.py@ 98103

Last change on this file since 98103 was 98103, checked in by vboxsync, 2 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.3 KB
Line 
1# -*- coding: utf-8 -*-
2# $Id: schedulerbeci.py 98103 2023-01-17 14:15:46Z vboxsync $
3
4"""
5Test Manager - Best-Effort-Continuous-Integration (BECI) scheduler.
6"""
7
8__copyright__ = \
9"""
10Copyright (C) 2012-2023 Oracle and/or its affiliates.
11
12This file is part of VirtualBox base platform packages, as
13available from https://www.virtualbox.org.
14
15This program is free software; you can redistribute it and/or
16modify it under the terms of the GNU General Public License
17as published by the Free Software Foundation, in version 3 of the
18License.
19
20This program is distributed in the hope that it will be useful, but
21WITHOUT ANY WARRANTY; without even the implied warranty of
22MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23General Public License for more details.
24
25You should have received a copy of the GNU General Public License
26along with this program; if not, see <https://www.gnu.org/licenses>.
27
28The contents of this file may alternatively be used under the terms
29of the Common Development and Distribution License Version 1.0
30(CDDL), a copy of it is provided in the "COPYING.CDDL" file included
31in the VirtualBox distribution, in which case the provisions of the
32CDDL are applicable instead of those of the GPL.
33
34You may elect to license modified versions of this file under the
35terms and conditions of either the GPL or the CDDL or both.
36
37SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
38"""
39__version__ = "$Revision: 98103 $"
40
41
42# Validation Kit imports.
43from testmanager.core.schedulerbase import SchedulerBase, SchedQueueData;
44
45
46class SchdulerBeci(SchedulerBase): # pylint: disable=too-few-public-methods
47 """
48 The best-effort-continuous-integration scheduler, BECI for short.
49 """
50
51 def __init__(self, oDb, oSchedGrpData, iVerbosity, tsSecStart):
52 SchedulerBase.__init__(self, oDb, oSchedGrpData, iVerbosity, tsSecStart);
53
54 def _recreateQueueItems(self, oData):
55 #
56 # Prepare the input data for the loop below. We compress the priority
57 # to reduce the number of loops we need to executes below.
58 #
59 # Note! For BECI test group priority only applies to the ordering of
60 # test groups, which has been resolved by the done sorting in the
61 # base class.
62 #
63 iMinPriority = 0x7fff;
64 iMaxPriority = 0;
65 for oTestGroup in oData.aoTestGroups:
66 for oTestCase in oTestGroup.aoTestCases:
67 iPrio = oTestCase.iSchedPriority;
68 assert iPrio in range(32);
69 iPrio = iPrio // 4;
70 assert iPrio in range(8);
71 if iPrio > iMaxPriority:
72 iMaxPriority = iPrio;
73 if iPrio < iMinPriority:
74 iMinPriority = iPrio;
75
76 oTestCase.iBeciPrio = iPrio;
77 oTestCase.iNextVariation = -1;
78
79 assert iMinPriority in range(8);
80 assert iMaxPriority in range(8);
81 assert iMinPriority <= iMaxPriority;
82
83 #
84 # Generate the
85 #
86 cMaxItems = len(oData.aoArgsVariations) * 64;
87 cMaxItems = min(cMaxItems, 1048576);
88
89 aoItems = [];
90 cNotAtEnd = len(oData.aoTestCases);
91 while len(aoItems) < cMaxItems:
92 self.msgDebug('outer loop: %s items' % (len(aoItems),));
93 for iPrio in range(iMaxPriority, iMinPriority - 1, -1):
94 #self.msgDebug('prio loop: %s' % (iPrio,));
95 for oTestGroup in oData.aoTestGroups:
96 #self.msgDebug('testgroup loop: %s' % (oTestGroup,));
97 for oTestCase in oTestGroup.aoTestCases:
98 #self.msgDebug('testcase loop: idTestCase=%s' % (oTestCase.idTestCase,));
99 if iPrio <= oTestCase.iBeciPrio and oTestCase.aoArgsVariations:
100 # Get variation.
101 iNext = oTestCase.iNextVariation;
102 if iNext != 0:
103 if iNext == -1: iNext = 0;
104 cNotAtEnd -= 1;
105 oArgsVariation = oTestCase.aoArgsVariations[iNext];
106
107 # Update next variation.
108 iNext = (iNext + 1) % len(oTestCase.aoArgsVariations);
109 cNotAtEnd += iNext != 0;
110 oTestCase.iNextVariation = iNext;
111
112 # Create queue item and append it.
113 oItem = SchedQueueData();
114 oItem.initFromValues(idSchedGroup = self._oSchedGrpData.idSchedGroup,
115 idGenTestCaseArgs = oArgsVariation.idGenTestCaseArgs,
116 idTestGroup = oTestGroup.idTestGroup,
117 aidTestGroupPreReqs = oTestGroup.aidTestGroupPreReqs,
118 bmHourlySchedule = oTestGroup.bmHourlySchedule,
119 cMissingGangMembers = oArgsVariation.cGangMembers,
120 offQueue = len(aoItems));
121 aoItems.append(oItem);
122
123 # Done?
124 if cNotAtEnd == 0:
125 self.msgDebug('returns %s items' % (len(aoItems),));
126 return aoItems;
127 return aoItems;
128
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette