Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions bobber/bobber.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,41 @@
from typing import NoReturn


def test_qty_validation(test_qty: str) -> str:
"""
Verify all test quantity values are positive integers.

Parameters
----------
test_qty : str
A ``string`` of the comma-separated test quantities from the user,
such as '1,2,3,...'

Returns
-------
str
Returns a ``string`` of the original test quantities list if all
test quantities are positive integers.

Raises
------
ArgumentTypeError
Raises an ``ArgumentTypeError`` if any of the passed test quantities
are non-integers or negative intergers.
"""
test_qty_list = test_qty.split(',')
conversion_test_list = []
for value in test_qty_list:
try:
conversion_test_list.append(int(value))
except ValueError:
raise ArgumentTypeError('Test quantity element invalid')

if int(value) <= 0:
raise ArgumentTypeError('Test quantity element is not positive')
return test_qty


def unique_hosts(hosts: str) -> str:
"""
Verify all hosts are unique.
Expand Down Expand Up @@ -158,6 +193,18 @@ def parse_args(version: str) -> Namespace:
'of a single system (so, 3 systems specified '
'would result in tests for 1, 2, and 3 '
'systems)', action='store_true')
commands_parent.add_argument('--test-qty', help='Comma-separated list of '
'host counts to test. For example, for a '
'list of 10 hosts specified via thse hosts '
'flag, to test only multiples of two, this '
'flag value should be 2,4,6,8,10. Note that '
'--sweep should also be present, otherwise '
'only the maximum number of systems '
'specified by --hosts will be tested. If '
'this flag is unspecified, all node counts '
'from 1 to the maximum number of systems '
'specified by --hosts will be tested',
type=test_qty_validation)
commands_parent.add_argument('--system', help='If system is specified, '
'iops-threads, 125k-threads, bw-threads, '
'gpus, batch size, and network interface '
Expand Down
10 changes: 7 additions & 3 deletions bobber/lib/tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,16 @@ def test_selector(args: Namespace, bobber_version: str) -> NoReturn:
"""
if args.sweep:
hosts = []
host_qtys_to_test = None
if args.test_qty:
host_qtys_to_test = args.test_qty.split(",")

for host in args.hosts.split(','):
hosts.append(host)
for iteration in range(1, args.iterations + 1):
host_string = ','.join(hosts)
kickoff_test(args, bobber_version, iteration, host_string)
if host_qtys_to_test is None or len(hosts) in host_qtys_to_test:
for iteration in range(1, args.iterations + 1):
host_string = ','.join(hosts)
kickoff_test(args, bobber_version, iteration, host_string)
else:
for iteration in range(1, args.iterations + 1):
kickoff_test(args, bobber_version, iteration, args.hosts)