Verified Commit f2b61a70 authored by Raphaël Bleuse's avatar Raphaël Bleuse
Browse files

Rely on parser to enforce valid scheduler name

parent 650766bb
......@@ -137,6 +137,8 @@ def _build_parser():
)
parser.add_argument(
'scheduler',
choices=sorted(set(name for name, _ in find_plugin_schedulers())),
metavar='scheduler',
help='name of the scheduler to run '
f'(as registered under \'{SCHEDULER_ENTRY_POINT}\' entry point)',
)
......@@ -200,10 +202,7 @@ def main(args=None):
# instantiate scheduler
_abort_on_ambiguous_scheduler_name(arguments.scheduler, parser=parser)
try:
scheduler = get_scheduler_by_name(arguments.scheduler, options=arguments.scheduler_options)
except ValueError:
parser.error(f'unknown scheduler \'{arguments.scheduler}\'')
scheduler = get_scheduler_by_name(arguments.scheduler, options=arguments.scheduler_options)
# launch simulation
run_simulation(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment