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

feature request: "prettier" error message for missing keys or empty YAML file #444

Open
wihobbs opened this issue Jun 4, 2024 · 1 comment

Comments

@wihobbs
Copy link
Member

wihobbs commented Jun 4, 2024

Hi folx! I was working with some new-to-HPC users in a tutorial this morning, and one of them observed that when a blank YAML or YAML missing values was passed to maestro run, you get an entire Python traceback:

(maestro_venv)   ruby968 /usr/global/docs/training/janeh $ maestro run ~/hostname.yaml
[2024-06-04 10:08:54: INFO] INFO Logging Level -- Enabled
[2024-06-04 10:08:54: WARNING] WARNING Logging Level -- Enabled
[2024-06-04 10:08:54: CRITICAL] CRITICAL Logging Level -- Enabled
[2024-06-04 10:08:54: INFO] Loading specification -- path = /g/g0/hobbs17/hostname.yaml
[2024-06-04 10:08:54: ERROR] ("'NoneType' object is not subscriptable",)
Traceback (most recent call last):
  File "/usr/global/docs/training/janeh/maestro_venv/lib/python3.10/site-packages/maestrowf/specification/yamlspecification.py", line 105, in load_specification
    specification = cls.load_specification_from_stream(data)
  File "/usr/global/docs/training/janeh/maestro_venv/lib/python3.10/site-packages/maestrowf/specification/yamlspecification.py", line 135, in load_specification_from_stream
    logger.debug("Loaded specification -- \n%s", spec["description"])
TypeError: 'NoneType' object is not subscriptable
Traceback (most recent call last):
  File "/usr/global/docs/training/janeh/maestro_venv/bin/maestro", line 8, in <module>
    sys.exit(main())
  File "/usr/global/docs/training/janeh/maestro_venv/lib/python3.10/site-packages/maestrowf/maestro.py", line 507, in main
    rc = args.func(args)
  File "/usr/global/docs/training/janeh/maestro_venv/lib/python3.10/site-packages/maestrowf/maestro.py", line 196, in run_study
    spec = YAMLSpecification.load_specification(args.specification)
  File "/usr/global/docs/training/janeh/maestro_venv/lib/python3.10/site-packages/maestrowf/specification/yamlspecification.py", line 109, in load_specification
    raise e
  File "/usr/global/docs/training/janeh/maestro_venv/lib/python3.10/site-packages/maestrowf/specification/yamlspecification.py", line 105, in load_specification
    specification = cls.load_specification_from_stream(data)
  File "/usr/global/docs/training/janeh/maestro_venv/lib/python3.10/site-packages/maestrowf/specification/yamlspecification.py", line 135, in load_specification_from_stream
    logger.debug("Loaded specification -- \n%s", spec["description"])
TypeError: 'NoneType' object is not subscriptable

It'd be great if this error were a little more condensed/descriptive of the problem: a missing "description" key in the YAML file (because the whole file is blank). Sorry to nit -- it just seems like this would be a fairly easy thing and helpful to newer users.

@jwhite242
Copy link
Collaborator

Oof, that is indeed an unhelpful output. I can certainly look into making that a little more human readable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants