Skip to content

Commit d60becf

Browse files
committed
Add ability to choose specific host counts to test via test-qty
Signed-Off-By: Joe Handzik <jhandzik@nvidia.com>
1 parent 580e6cb commit d60becf

2 files changed

Lines changed: 54 additions & 3 deletions

File tree

bobber/bobber.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,41 @@
2828
from typing import NoReturn
2929

3030

31+
def test_qty_validation(test_qty: str) -> str:
32+
"""
33+
Verify all test quantity values are positive integers.
34+
35+
Parameters
36+
----------
37+
test_qty : str
38+
A ``string`` of the comma-separated test quantities from the user,
39+
such as '1,2,3,...'
40+
41+
Returns
42+
-------
43+
str
44+
Returns a ``string`` of the original test quantities list if all
45+
test quantities are positive integers.
46+
47+
Raises
48+
------
49+
ArgumentTypeError
50+
Raises an ``ArgumentTypeError`` if any of the passed test quantities
51+
are non-integers or negative intergers.
52+
"""
53+
test_qty_list = test_qty.split(',')
54+
conversion_test_list = []
55+
for value in test_qty_list:
56+
try:
57+
conversion_test_list.append(int(value))
58+
except ValueError:
59+
raise ArgumentTypeError('Test quantity element invalid')
60+
61+
if int(value) <= 0:
62+
raise ArgumentTypeError('Test quantity element is not positive')
63+
return test_qty
64+
65+
3166
def unique_hosts(hosts: str) -> str:
3267
"""
3368
Verify all hosts are unique.
@@ -142,6 +177,18 @@ def parse_args(version: str) -> Namespace:
142177
'of a single system (so, 3 systems specified '
143178
'would result in tests for 1, 2, and 3 '
144179
'systems)', action='store_true')
180+
commands_parent.add_argument('--test-qty', help='Comma-separated list of '
181+
'host counts to test. For example, for a '
182+
'list of 10 hosts specified via thse hosts '
183+
'flag, to test only multiples of two, this '
184+
'flag value should be 2,4,6,8,10. Note that '
185+
'--sweep should also be present, otherwise '
186+
'only the maximum number of systems '
187+
'specified by --hosts will be tested. If '
188+
'this flag is unspecified, all node counts '
189+
'from 1 to the maximum number of systems '
190+
'specified by --hosts will be tested',
191+
type=test_qty_validation)
145192
commands_parent.add_argument('--system', help='If system is specified, '
146193
'iops-threads, bw-threads, gpus, batch size, '
147194
'and network interface names are given '

bobber/lib/tests/run_tests.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,16 @@ def test_selector(args: Namespace, bobber_version: str) -> NoReturn:
282282
"""
283283
if args.sweep:
284284
hosts = []
285+
host_qtys_to_test = None
286+
if args.test_qty:
287+
host_qtys_to_test = args.test_qty.split(",")
285288

286289
for host in args.hosts.split(','):
287290
hosts.append(host)
288-
for iteration in range(1, args.iterations + 1):
289-
host_string = ','.join(hosts)
290-
kickoff_test(args, bobber_version, iteration, host_string)
291+
if host_qtys_to_test is None or len(hosts) in host_qtys_to_test:
292+
for iteration in range(1, args.iterations + 1):
293+
host_string = ','.join(hosts)
294+
kickoff_test(args, bobber_version, iteration, host_string)
291295
else:
292296
for iteration in range(1, args.iterations + 1):
293297
kickoff_test(args, bobber_version, iteration, args.hosts)

0 commit comments

Comments
 (0)