-
Notifications
You must be signed in to change notification settings - Fork 405
Changes to filename_template checks #1464
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
base: develop
Are you sure you want to change the base?
Changes from 8 commits
30b74f7
42399bc
74af38b
8eb3e56
64e5856
3bf5404
5c7a075
97c6d25
741c495
035a4a7
f5e7f5c
ff95f35
5d54033
a30e46c
0376fed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -563,10 +563,104 @@ subroutine MPAS_stream_mgr_validate_streams(manager, streamID, ierr)!{{{ | |
| #endif | ||
|
|
||
| end do | ||
|
|
||
| ! Only check filename_template uniqueness when validating all streams | ||
| if (.not. present(streamID)) then | ||
| call MPAS_stream_mgr_check_filename_template(manager, ierr=err_local) | ||
| if (present(ierr)) ierr = err_local | ||
| end if | ||
|
|
||
| end subroutine MPAS_stream_mgr_validate_streams!}}} | ||
|
|
||
|
|
||
| !----------------------------------------------------------------------- | ||
| ! routine MPAS_stream_mgr_check_filename_template | ||
| ! | ||
| !> \brief Check for identical filename templates in active output streams. | ||
| !> \author Abishek Gopal | ||
| !> \date June 3 2026 | ||
| !> \details | ||
| !> Checks that there are no identical filename templates among active output | ||
| !> streams in the stream manager, which may lead to file conflicts. This | ||
| !> routine can be called from within MPAS_stream_mgr_validate_streams or | ||
| !> separately as needed. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we add a sentence or two about the return values from this routine? That may be especially relevant, since the return value of this routine may be used directly as the return value to It might also be helpful to add a bit more detail as to what exactly this routine is checking. For example, the description "among active I/O streams" suggests that two active input streams might be caught by this routine. |
||
| ! | ||
| !----------------------------------------------------------------------- | ||
| subroutine MPAS_stream_mgr_check_filename_template(manager, ierr)!{{{ | ||
|
|
||
| implicit none | ||
|
|
||
| type (MPAS_streamManager_type), intent(inout) :: manager | ||
| integer, intent(out), optional :: ierr | ||
|
mgduda marked this conversation as resolved.
|
||
|
|
||
| integer :: threadNum | ||
| character (len=StrKIND) :: message, streamID | ||
| type (MPAS_stream_list_type), pointer :: stream1_cursor, stream2_cursor | ||
| logical :: stream1_pkg_active, stream2_pkg_active | ||
| logical :: stream1_output, stream2_output | ||
|
|
||
| STREAM_DEBUG_WRITE('-- Called MPAS_stream_mgr_check_filename_template() for all streams') | ||
|
|
||
| if (present(ierr)) ierr = MPAS_STREAM_LIST_NOERR | ||
|
mgduda marked this conversation as resolved.
Outdated
|
||
|
|
||
| threadNum = mpas_threading_get_thread_num() | ||
|
|
||
| if ( threadNum == 0 ) then | ||
|
|
||
| streamID = '.*' ! query all streams | ||
|
|
||
| nullify(stream1_cursor) | ||
| do while (MPAS_stream_list_query(manager % streams, streamID, stream1_cursor)) | ||
|
mgduda marked this conversation as resolved.
|
||
|
|
||
| stream1_pkg_active = stream_active_pkg_check(stream1_cursor) | ||
| stream1_output = (stream1_cursor % direction == MPAS_STREAM_OUTPUT) .or. & | ||
| (stream1_cursor % direction == MPAS_STREAM_INPUT_OUTPUT) | ||
|
|
||
| call mpas_log_write('Stream 1 '//trim(stream1_cursor % name)//' filename '//trim(stream1_cursor % filename_template)//' & | ||
| & active = $l output = $l packages_active $l',logicArgs=(/stream1_cursor % active_stream, stream1_output, stream1_pkg_active/)) | ||
|
|
||
| if (.not. stream1_cursor % active_stream .or. .not. stream1_output & | ||
| .or. .not. stream1_pkg_active) then | ||
|
mgduda marked this conversation as resolved.
Outdated
|
||
| cycle | ||
| end if | ||
|
|
||
| nullify(stream2_cursor) | ||
| do while (MPAS_stream_list_query(manager % streams, streamID, stream2_cursor)) | ||
|
|
||
| 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) | ||
|
mgduda marked this conversation as resolved.
Outdated
|
||
|
|
||
| ! uniqueness_check has already checked that two different streams do not have the same name | ||
| if (trim(stream1_cursor % name) == trim(stream2_cursor % name) & | ||
| .or. .not. stream2_cursor % active_stream & | ||
| .or. .not. stream2_output & | ||
| .or. .not. stream2_pkg_active) then | ||
| cycle | ||
| end if | ||
|
|
||
| call mpas_log_write('Stream 2 '//trim(stream2_cursor % name)//' filename '//trim(stream2_cursor % filename_template)//' & | ||
| & active = $l output = $l pkg_active: $l',logicArgs=(/stream2_cursor % active_stream, stream2_output, stream2_pkg_active/)) | ||
|
|
||
| if (trim(stream1_cursor % filename_template) == trim(stream2_cursor % filename_template)) then | ||
| message = 'Found identical values of the filename_template attribute for multiple & | ||
| active output streams (' // trim(stream1_cursor % name) // ' and ' // & | ||
| trim(stream2_cursor % name) // ') in streams.<CORE>. This may result in & | ||
| file conflicts.' | ||
|
mgduda marked this conversation as resolved.
Outdated
|
||
| call mpas_log_write(message) | ||
|
mgduda marked this conversation as resolved.
|
||
| if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR | ||
| return | ||
|
mgduda marked this conversation as resolved.
Outdated
|
||
| end if | ||
|
|
||
| end do | ||
|
|
||
| end do | ||
|
|
||
| end if | ||
|
|
||
| end subroutine MPAS_stream_mgr_check_filename_template!}}} | ||
|
|
||
|
|
||
| !----------------------------------------------------------------------- | ||
| ! routine MPAS_stream_mgr_destroy_stream | ||
| ! | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.