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

Improve error message on incorrect machine #892

Merged
merged 1 commit into from
Sep 19, 2022

Conversation

xylar
Copy link
Collaborator

@xylar xylar commented Sep 19, 2022

Now, when you give an incorrect machine, e.g.:

mpas_analysis -m blah example_e3sm.cfg

you get an error message like:

Traceback (most recent call last):
  File "/home/xylar/code/MPAS-Analysis/improve_error_on_wrong_machine/mpas_analysis/__main__.py", line 799, in main
    config.add_from_package('mache.machines', f'{machine}.cfg')
  File "/home/xylar/mambaforge/envs/mpas_dev/lib/python3.10/site-packages/mpas_tools/config.py", line 87, in add_from_package
    self._add(path, user=False)
  File "/home/xylar/mambaforge/envs/mpas_dev/lib/python3.10/site-packages/mpas_tools/config.py", line 426, in _add
    raise FileNotFoundError(f'Config file does not exist: {filename}')
FileNotFoundError: Config file does not exist: /home/xylar/mambaforge/envs/mpas_dev/lib/python3.10/site-packages/mache/machines/blah.cfg

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/xylar/mambaforge/envs/mpas_dev/bin/mpas_analysis", line 33, in <module>
    sys.exit(load_entry_point('mpas-analysis', 'console_scripts', 'mpas_analysis')())
  File "/home/xylar/code/MPAS-Analysis/improve_error_on_wrong_machine/mpas_analysis/__main__.py", line 809, in main
    raise ValueError(
ValueError: We could not find the machine: blah.
Possible machines are:
  acme1
  andes
  anvil
  badger
  chrysalis
  compy
  cooley
  cori-haswell
  cori-knl
  default
  grizzly

closes #891

@xylar xylar added the clean up label Sep 19, 2022
@xylar xylar requested a review from cbegeman September 19, 2022 20:50
@xylar xylar self-assigned this Sep 19, 2022
@xylar
Copy link
Collaborator Author

xylar commented Sep 19, 2022

@cbegeman, could you review this by inspection (just letting me know if this new output seems intuitive)?

@cbegeman
Copy link
Collaborator

@xylar Looks good to me! Thanks!

@xylar
Copy link
Collaborator Author

xylar commented Sep 19, 2022

Thanks for taking a look, @cbegeman!

@xylar xylar merged commit 169ada5 into MPAS-Dev:develop Sep 19, 2022
@xylar xylar deleted the improve_error_on_wrong_machine branch September 19, 2022 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error is not intuitive when an incorrect machine is specified
2 participants