ESMCI / cime

Common Infrastructure for Modeling the Earth
http://esmci.github.io/cime
Other
161 stars 206 forks source link

Error message could be in simpler English for incorrect syntax in test names #4449

Open slevis-lmwg opened 1 year ago

slevis-lmwg commented 1 year ago

./create_test SMS_L10d_D_Mmpi-serial.CLM_USRDAT.I1PtClm51Bgc.izumi_nag.clm-default--clm-NEON-NIWO gave me this error:

Finished XML for test SMS_L10d_D_Mmpi-serial.CLM_USRDAT.I1PtClm51Bgc.izumi_nag.clm-default--clm-NEON-NIWO in 0.232909 seconds (FAIL). [COMPLETED 1 of 1]
    Case dir: /scratch/cluster/slevis/SMS_L10d_D_Mmpi-serial.CLM_USRDAT.I1PtClm51Bgc.izumi_nag.clm-default--clm-NEON-NIWO.20230627_133512_wvaqn7
    Errors were:
        Test 'SMS_L10d_D_Mmpi-serial.CLM_USRDAT.I1PtClm51Bgc.izumi_nag.clm-default--clm-NEON-NIWO' failed in phase 'XML' with exception ''NoneType' object has no attribute 'group''
          File "/fs/cgd/data0/slevis/git/add_xs_ground_ice_pr1787/cime/CIME/test_scheduler.py", line 1093, in _run_catch_exceptions
            return run(test)
          File "/fs/cgd/data0/slevis/git/add_xs_ground_ice_pr1787/cime/CIME/test_scheduler.py", line 885, in _xml_phase
            opt = match.group(1)

For the test to work, @ekluzek and I discovered that we needed to replace L10d with Ld10 in the test name.

Relates to https://github.com/ESCOMP/CTSM/issues/2043

ekluzek commented 1 year ago

The part of the code is here:

                elif opt.startswith("L"):
                    match = re.match("L([A-Za-z])([0-9]*)", opt)
                    stop_option = {
                        "y": "nyears",
                        "m": "nmonths",
                        "d": "ndays",
                        "h": "nhours",
                        "s": "nseconds",
                        "n": "nsteps",
                    }
                    opt = match.group(1)

What should happen is that match should be queried to ensure it's a valid match. If it isn't it should return a sensible error to explain what went wrong. This same sort of thing should be added to other such matches for test types. This would allow the user to debug the problem on their own, rather than having to struggle to figure it out.

An interesting thing here is that the above actually worked for me even though it probably shouldn't have. So a better error check would be better for everyone.

github-actions[bot] commented 11 months ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.