Check whether the given argument has valid goodput configuration or not
(args)
| 971 | |
| 972 | |
| 973 | def check_goodput_args(args): |
| 974 | """Check whether the given argument has valid goodput configuration or not""" |
| 975 | # Check and parse goodput arguments |
| 976 | goodput_config_dict = {} |
| 977 | VALID_NAMES = ["ttft", "tpot", "e2el"] |
| 978 | if args.goodput: |
| 979 | goodput_config_dict = parse_goodput(args.goodput) |
| 980 | for slo_name, slo_val in goodput_config_dict.items(): |
| 981 | if slo_name not in VALID_NAMES: |
| 982 | raise ValueError( |
| 983 | f"Invalid metric name found, {slo_name}: {slo_val}. " |
| 984 | "The service level objective name should be one of " |
| 985 | f"{VALID_NAMES!s}. " |
| 986 | ) |
| 987 | if slo_val < 0: |
| 988 | raise ValueError( |
| 989 | f"Invalid value found, {slo_name}: {slo_val}. " |
| 990 | "The service level objective value should be " |
| 991 | "non-negative." |
| 992 | ) |
| 993 | return goodput_config_dict |
| 994 | |
| 995 | |
| 996 | def parse_goodput(slo_pairs): |
no test coverage detected