Skip to content

Commit ce007bc

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 7d09f5a commit ce007bc

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
@@ -31,6 +31,41 @@
3131
from typing import NoReturn
3232

3333

34+
def test_qty_validation(test_qty: str) -> str:
35+
"""
36+
Verify all test quantity values are positive integers.
37+
38+
Parameters
39+
----------
40+
test_qty : str
41+
A ``string`` of the comma-separated test quantities from the user,
42+
such as '1,2,3,...'
43+
44+
Returns
45+
-------
46+
str
47+
Returns a ``string`` of the original test quantities list if all
48+
test quantities are positive integers.
49+
50+
Raises
51+
------
52+
ArgumentTypeError
53+
Raises an ``ArgumentTypeError`` if any of the passed test quantities
54+
are non-integers or negative intergers.
55+
"""
56+
test_qty_list = test_qty.split(',')
57+
conversion_test_list = []
58+
for value in test_qty_list:
59+
try:
60+
conversion_test_list.append(int(value))
61+
except ValueError:
62+
raise ArgumentTypeError('Test quantity element invalid')
63+
64+
if int(value) <= 0:
65+
raise ArgumentTypeError('Test quantity element is not positive')
66+
return test_qty
67+
68+
3469
def unique_hosts(hosts: str) -> str:
3570
"""
3671
Verify all hosts are unique.
@@ -158,6 +193,18 @@ def parse_args(version: str) -> Namespace:
158193
'of a single system (so, 3 systems specified '
159194
'would result in tests for 1, 2, and 3 '
160195
'systems)', action='store_true')
196+
commands_parent.add_argument('--test-qty', help='Comma-separated list of '
197+
'host counts to test. For example, for a '
198+
'list of 10 hosts specified via thse hosts '
199+
'flag, to test only multiples of two, this '
200+
'flag value should be 2,4,6,8,10. Note that '
201+
'--sweep should also be present, otherwise '
202+
'only the maximum number of systems '
203+
'specified by --hosts will be tested. If '
204+
'this flag is unspecified, all node counts '
205+
'from 1 to the maximum number of systems '
206+
'specified by --hosts will be tested',
207+
type=test_qty_validation)
161208
commands_parent.add_argument('--system', help='If system is specified, '
162209
'iops-threads, 125k-threads, bw-threads, '
163210
'gpus, batch size, and network interface '

bobber/lib/tests/run_tests.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,12 +340,16 @@ def test_selector(args: Namespace, bobber_version: str) -> NoReturn:
340340
"""
341341
if args.sweep:
342342
hosts = []
343+
host_qtys_to_test = None
344+
if args.test_qty:
345+
host_qtys_to_test = args.test_qty.split(",")
343346

344347
for host in args.hosts.split(','):
345348
hosts.append(host)
346-
for iteration in range(1, args.iterations + 1):
347-
host_string = ','.join(hosts)
348-
kickoff_test(args, bobber_version, iteration, host_string)
349+
if host_qtys_to_test is None or len(hosts) in host_qtys_to_test:
350+
for iteration in range(1, args.iterations + 1):
351+
host_string = ','.join(hosts)
352+
kickoff_test(args, bobber_version, iteration, host_string)
349353
else:
350354
for iteration in range(1, args.iterations + 1):
351355
kickoff_test(args, bobber_version, iteration, args.hosts)

0 commit comments

Comments
 (0)