ESCOMP / CAM-SIMA

Community Atmosphere Model - System for Integrated Modeling of the Atmosphere
4 stars 12 forks source link

Improve error message returned by XML linter #286

Open peverwhee opened 1 month ago

peverwhee commented 1 month ago

What is the feature/what would you like to discuss?

Currently, the xmllint-ing step in generate_registry_data.py returns the following stack trace and message if the validation fails:

Traceback (most recent call last):
  File "/home/courtneyp/Projects/cam_sima_zm/cime_config/buildnml", line 412, in <module>
    _main_func()
  File "/home/courtneyp/Projects/cam_sima_zm/cime_config/buildnml", line 408, in _main_func
    buildnml(case, caseroot, "cam")
  File "/home/courtneyp/Projects/cam_sima_zm/cime_config/buildnml", line 172, in buildnml
    config.generate_cam_src(gen_indent)
  File "/home/courtneyp/Projects/cam_sima_zm/cime_config/cam_config.py", line 838, in generate_cam_src
    retvals = generate_registry(data_search, build_cache, self.__atm_root,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/courtneyp/Projects/cam_sima_zm/cime_config/cam_autogen.py", line 391, in generate_registry
    retvals = gen_registry(reg_file, dycore, genreg_dir,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/courtneyp/Projects/cam_sima_zm/src/data/generate_registry_data.py", line 1799, in gen_registry
    raise CCPPError(emsg)
parse_source.CCPPError: Invalid registry file, /home/courtneyp/Projects/cam_sima_zm/src/data/registry.xml
/cluster/anaconda-3.11.5/bin/xmllint --noout --schema /home/courtneyp/Projects/cam_sima_zm/src/data/registry_v1_0.xsd /home/courtneyp/Projects/cam_sima_zm/src/data/registry.xml
ERROR: /home/courtneyp/Projects/cam_sima_zm/cime_config/buildnml /scratch/cluster/courtneyp/sima-zm-ne3 FAILED, see above

It would be nice if the message:

  1. Printed the actual error returned from xmllint, AND/OR
  2. Included a message like "To see the error from xmllint, run this command:"

Is there anyone in particular you want to be part of this conversation?

No response

Will this change (regression test) answers?

No

Will you be implementing this enhancement yourself?

Any Software Engineer can do this