VirtualBox

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

Last change on this file since 78697 was 76553, checked in by vboxsync, 6 years ago

scm --update-copyright-year

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