Skip to content

Commit 334cdef

Browse files
authored
Merge branch 'master' into source-download
2 parents 395eae0 + ee2a811 commit 334cdef

File tree

3 files changed

+46
-4
lines changed

3 files changed

+46
-4
lines changed

lib/pavilion/series/series.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,13 @@ def _create_test_sets(self, iteration=0):
270270
# create all TestSet objects
271271
universal_modes = self.config['modes']
272272
for set_name, set_info in self.config['test_sets'].items():
273+
# Checks if the simultaneous key is set inside the test_set, if so, simultaneous limit
274+
# set in the test_set will override the simultaneous key at the full series level
275+
if set_info['simultaneous']:
276+
_simultaneous = set_info['simultaneous']
277+
else:
278+
_simultaneous = self.simultaneous
279+
273280
set_obj = TestSet(
274281
pav_cfg=self.pav_cfg,
275282
name=set_name,
@@ -283,7 +290,7 @@ def _create_test_sets(self, iteration=0):
283290
parents_must_pass=set_info['depends_pass'],
284291
overrides=self.config.get('overrides', []),
285292
status=self.status,
286-
simultaneous=self.simultaneous,
293+
simultaneous= _simultaneous,
287294
outfile=self.outfile,
288295
verbosity=self.verbosity,
289296
ignore_errors=self.ignore_errors,
@@ -510,9 +517,10 @@ def _run_set(self, test_set: TestSet, build_only: bool, rebuild: bool, local_bui
510517
"in series {}."
511518
.format(ktests, len(started_tests),
512519
test_set.name, self.sid))
513-
520+
# If simultaneous is set in the test_set, use that.
521+
_simultaneous = test_set.simultaneous if test_set.simultaneous else self.simultaneous
514522
# Wait for jobs until enough have finished to start a new batch.
515-
while tests_running + self.batch_size > self.simultaneous:
523+
while tests_running + self.batch_size > _simultaneous:
516524
tests_running -= test_set.wait()
517525

518526

@@ -583,6 +591,7 @@ def add_test_set_config(
583591
self, name, test_names: List[str], modes: List[str] = None,
584592
only_if: Dict[str, List[str]] = None,
585593
not_if: Dict[str, List[str]] = None,
594+
simultaneous: int = None,
586595
save: bool = True,
587596
_depends_on: List[str] = None, _depends_pass: bool = False):
588597
"""Manually add a test set to this series. The set will be added to the
@@ -594,6 +603,7 @@ def add_test_set_config(
594603
:param modes: A List of modes to add.
595604
:param only_if: Only if conditions
596605
:param not_if: Not if conditions
606+
:param simultaneous: Number of tests within the test set to run simultaneously.
597607
:param save: Save the series config after adding the test set. Setting this
598608
to false is useful if you want to add multiple configs before saving.
599609
:param _depends_on: A list of test names that this test depends on. For
@@ -613,6 +623,7 @@ def add_test_set_config(
613623
'modes': modes or [],
614624
'only_if': only_if or {},
615625
'not_if': not_if or {},
626+
'simultaneous': simultaneous,
616627
}
617628

618629
if save:

lib/pavilion/series_config/file_format.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class SeriesConfigLoader(yc.YamlConfigLoader):
1818
yc.BoolElem('depends_pass', default=False),
1919
yc.ListElem('depends_on', sub_elem=yc.StrElem()),
2020
yc.ListElem('modes', sub_elem=yc.StrElem()),
21+
yc.IntElem('simultaneous', default=None),
2122
CondCategoryElem(
2223
'only_if', sub_elem=yc.ListElem(sub_elem=yc.StrElem()),
2324
key_case=EnvCatElem.KC_MIXED
@@ -62,7 +63,9 @@ class SeriesConfigLoader(yc.YamlConfigLoader):
6263
),
6364
yc.IntElem(
6465
'simultaneous', default=0,
65-
help_text="The maximum number of tests to run simultaneously."
66+
help_text="The maximum number of tests to run simultaneously. This can be"
67+
" set at the full series level and/or at each test_set level. If"
68+
" set at both levels then test_set will take precedence."
6669
),
6770
yc.BoolElem(
6871
'ordered', default=False,

test/tests/series_tests.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,34 @@ def test_series_simultaneous(self):
111111
self.assertLessEqual(last_ended, started)
112112
last_ended = ended
113113

114+
def test_series_test_set_simultaneous(self):
115+
"""Test to see if simultaneous in the test_set overrides the simultaneous at full series"""
116+
series_sec_cfg = OrderedDict()
117+
series_sec_cfg['set1'] = {
118+
'tests': ['echo_test.b', 'echo_test.b', 'echo_test.b'],
119+
'simultaneous': 1
120+
}
121+
122+
series_cfg = series_config.make_config({
123+
'test_sets': series_sec_cfg,
124+
'modes': ['smode2'],
125+
'simultaneous': '3',
126+
'ignore_errors': False,
127+
})
128+
129+
test_series_obj = series.TestSeries(self.pav_cfg, series_cfg=series_cfg)
130+
test_series_obj.run()
131+
test_series_obj.wait(timeout=10)
132+
133+
last_ended = None
134+
for test_id in sorted(test_series_obj.tests):
135+
test_obj = test_series_obj.tests[test_id]
136+
started = test_obj.results['started']
137+
ended = test_obj.results['finished']
138+
if last_ended is not None:
139+
self.assertLessEqual(last_ended, started)
140+
last_ended = ended
141+
114142
def test_series_modes(self):
115143
"""Test if modes and host are applied correctly."""
116144

0 commit comments

Comments
 (0)