Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw exceptions for bad input parameters #52

Merged
merged 2 commits into from
Nov 8, 2023
Merged
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
20 changes: 13 additions & 7 deletions bin/benchpark
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,30 @@ def benchpark_list_handler(args):
for system in systems:
print(f"\t{system}")
else:
print(
f"Invalid benchpark list [{sublist}] - must choose [benchmarks],[systems], or leave empty"
raise ValueError(
f'Invalid benchpark list "{sublist}" - must choose [benchmarks], [systems], or leave empty'
)


def benchpark_check_benchmark(arg_str):
benchmarks = benchpark_benchmarks()
found = arg_str in benchmarks
if not found:
print(f"Invalid benchmark/experiment {arg_str} - must choose one of: ")
out_str = f'Invalid benchmark/experiment "{arg_str}" - must choose one of: '
for benchmark in benchmarks:
print(f"\t{benchmark}")
out_str += f"\n\t{benchmark}"
raise ValueError(out_str)
return found


def benchpark_check_system(arg_str):
systems = benchpark_systems()
found = arg_str in systems
if not found:
print(f"Invalid system {arg_str} - must choose one of: ")
out_str = f'Invalid system "{arg_str}" - must choose one of: '
for system in systems:
print(f"\t{system}")
out_str += f"\n\t{system}"
raise ValueError(out_str)
return found


Expand Down Expand Up @@ -192,7 +194,11 @@ def benchpark_setup_handler(args):
debug_print(f"specified system = {system}")
valid_system = benchpark_check_system(system)
if not (valid_benchmark and valid_system):
return
raise ValueError(
"Invalid benchmark/experiment and system provided: {0} {1}".format(
benchmark, system
)
)

workspace_dir = workspace_root / str(benchmark) / str(system)

Expand Down
Loading