-
Notifications
You must be signed in to change notification settings - Fork 178
Description
We're trying to run WPS and WRF in an automated setting. We want the workflow to fail as soon as one of the steps fail. For this, we rely on the exit status of each of the programs.
We've noticed that under certain conditions, geogrid and metgrid fail with a 0 exit status. This happened when we ran geogrid with the wrong vtable, and again when metgrid didn't find the ./geo_em.d01.nc files.
For example:
+ /home/pkalverla1/wrf-model/WPS/geogrid.exe
Parsed 50 entries in GEOGRID.TBL
Processing domain 1 of 1
ERROR: Could not open /projects/0/prjs0914/wrf-data/default/static/WPS_GEOG/landfire_data/index
Despite this error message, the exit status was 0. Similarly for metgrid later on:
+ /home/pkalverla1/wrf-model/WPS/metgrid.exe
Processing domain 1 of 1
ERROR: Couldn't open file ./geo_em.d01.nc for input.
It seems the error originates here
WPS/geogrid/src/source_data_module.F
Lines 866 to 878 in 5a2ae63
| if (iostatus /= 0) then | |
| if (is_optional(idx)) then | |
| is_not_found(idx) = .true. | |
| call mprintf(.true.,INFORM,'Could not read ''index'' file %s for field %s', s1=trim(test_fname), & | |
| s2=trim(source_fieldname(idx))) | |
| call mprintf(.true.,INFORM,'This field is optional and will not be processed.') | |
| else | |
| call mprintf(.true.,ERROR,'Could not open %s', s1=trim(test_fname)) | |
| end if | |
| cycle ENTRY_LOOP | |
| end if |
The ERROR level is handled in mprintf:
WPS/geogrid/src/module_debug.F
Lines 316 to 324 in 5a2ae63
| if (level == ERROR) then | |
| #ifdef _GEOGRID | |
| call parallel_abort() | |
| #endif | |
| #ifdef _METGRID | |
| call parallel_abort() | |
| #endif | |
| stop | |
| end if |
I'm not very experienced in writing Fortran code, but I wonder if this could be solved by adding an integer status code to the stop command, or by using error stop instead, as suggested here. If so, I'm happy to open a PR.