Changes to filename_template checks #1464
Conversation
|
|
||
| stream2_pkg_active = stream_active_pkg_check(stream2_cursor) | ||
| stream2_output = (stream2_cursor % direction == MPAS_STREAM_OUTPUT) .or. & | ||
| (stream2_cursor % direction == MPAS_STREAM_INPUT_OUTPUT) |
There was a problem hiding this comment.
I may be misreading the logic, but it looks like we will only catch cases where two output (or input-output) streams share a filename_template. However, I think we would also want to catch cases where an active input stream shares a filename_template with an active output (or input-output) stream.
| ', in streams.<CORE>. This may result in file conflicts.' | ||
| call mpas_log_write(message, messageType=MPAS_LOG_ERR) | ||
| if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR | ||
| return |
There was a problem hiding this comment.
Rather than returning on the first pair of matching filename_template values, we could instead report all errors before returning. Admittedly, it may not be common for someone to define more than two streams that share a filename_template (or more than one pair of streams that conflict), but I think it's a small enough change to report all errors before returning that it's worth doing.
| stream1_output = (stream1_cursor % direction == MPAS_STREAM_OUTPUT) .or. & | ||
| (stream1_cursor % direction == MPAS_STREAM_INPUT_OUTPUT) | ||
|
|
||
| if (.not. stream1_cursor % active_stream .or. .not. stream1_output .or. .not. stream1_pkg_active) then |
There was a problem hiding this comment.
Thinking about it a bit more, perhaps we could also skip (for the purpose of finding duplicate filename_template values) streams whose input_interval or output_interval is none, since that stream -- although potentially active -- would never be read or written?
Previously, if two active, output stream definitions in the streams. file specified the same string as the
filename_templateattribute, the corresponding MPAS CORE would crash with an error message. This was also the case for when one of the streams, sharing thefilename_template, included an inactive package, hence effectively making it inactive. The existing logic to perform stream uniqueness checks insrc/framework/xml_stream_parser.cdid not have the information about which packages associated with a stream were active, and hence did not account for inactive packages.This PR introduces a new subroutine
MPAS_stream_mgr_check_filename_templateinsrc/framework/mpas_stream_manager.Fto check for unique filename_templates only for streams that are both active, output streams and are not associated with packages that are currently inactive. This subroutine is called from withinMPAS_stream_mgr_validate_streams.The previous logic to check for unique
filename_templateattributes insrc/framework/xml_stream_parser.chas been removed, while retaining the checks for unique stream names