Closed
Description
🐛 Bug
When providing an invalid scheduler to the CLI it throws a KeyError. It would probably be better to catch the error and provide a user-friendly error message.
Module (check all that applies):
-
torchx.spec
-
torchx.component
-
torchx.apps
-
torchx.runtime
-
torchx.cli
-
torchx.schedulers
-
torchx.pipelines
-
torchx.aws
-
torchx.examples
-
other
To Reproduce
Steps to reproduce the behavior:
- Run the torchx CLI with an invalid scheduler (e.g., torchx run -s machinelearning --dryrun
$ torchx run -s machinelearning --dryrun
Traceback (most recent call last):
File "/usr/local/bin/torchx", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.10/dist-packages/torchx/cli/main.py", line 110, in main
run_main(get_sub_cmds(), argv)
File "/usr/local/lib/python3.10/dist-packages/torchx/cli/main.py", line 106, in run_main
args.func(args)
File "/usr/local/lib/python3.10/dist-packages/torchx/cli/cmd_run.py", line 271, in run
self._run(runner, args)
File "/usr/local/lib/python3.10/dist-packages/torchx/cli/cmd_run.py", line 206, in _run
scheduler_opts = run_opts[args.scheduler]
KeyError: 'machinelearning'
Expected behavior
Instead of throwing a key error and showing a stack trace it should throw a user-friendly error message.
Environment
- torchx version (e.g. 0.1.0rc1): torchx-0.1.2
- Python version: Python 3.10.4
- OS (e.g., Linux): Linux
- How you installed torchx (
conda
,pip
, source,docker
): pip - Docker image and tag (if using docker): ubuntu:latest
- Git commit (if installed from source): N/A
- Execution environment (on-prem, AWS, GCP, Azure etc): Docker
- Any other relevant information: N/A
Additional context
I have a PR ready if this is a valid bug.
Metadata
Metadata
Assignees
Labels
No labels