|
31 | 31 | from typing import NoReturn |
32 | 32 |
|
33 | 33 |
|
| 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 | + |
34 | 69 | def unique_hosts(hosts: str) -> str: |
35 | 70 | """ |
36 | 71 | Verify all hosts are unique. |
@@ -158,6 +193,18 @@ def parse_args(version: str) -> Namespace: |
158 | 193 | 'of a single system (so, 3 systems specified ' |
159 | 194 | 'would result in tests for 1, 2, and 3 ' |
160 | 195 | '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) |
161 | 208 | commands_parent.add_argument('--system', help='If system is specified, ' |
162 | 209 | 'iops-threads, 125k-threads, bw-threads, ' |
163 | 210 | 'gpus, batch size, and network interface ' |
|
0 commit comments