-
Notifications
You must be signed in to change notification settings - Fork 96
#6598 cat-log: new auto cat/tail mode #6913
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
Merged
wxtim
merged 6 commits into
cylc:master
from
ChrisPaulBennett:6598-cat-log-new-auto-cattail-mode
Oct 15, 2025
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3f08cb8
Initial commit
ChrisPaulBennett 1693f4c
More unit tests
ChrisPaulBennett a6bb984
Refactoring out hard coded strings
ChrisPaulBennett 1a02636
Implemented proper wildcarding in test
ChrisPaulBennett 2165345
Implemented proper wildcarding in test
ChrisPaulBennett 1cf4fe6
Code review changes
ChrisPaulBennett File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| #!/usr/bin/env bash | ||
| # THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE. | ||
| # Copyright (C) NIWA & British Crown (Met Office) & Contributors. | ||
| # | ||
| # This program is free software: you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation, either version 3 of the License, or | ||
| # (at your option) any later version. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| #------------------------------------------------------------------------------- | ||
| # Test "cylc cat-log" using auto mode with a custom tail /command | ||
| . "$(dirname "$0")/test_header" | ||
| #------------------------------------------------------------------------------- | ||
| set_test_number 7 | ||
| install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}" | ||
| create_test_global_config "" " | ||
| [platforms] | ||
| [[localhost]] | ||
| tail command template = $PWD/bin/my-tailer.sh %(filename)s | ||
| " | ||
| #------------------------------------------------------------------------------- | ||
| TEST_NAME="${TEST_NAME_BASE}-validate" | ||
| run_ok "${TEST_NAME}" cylc validate "${WORKFLOW_NAME}" | ||
| workflow_run_ok "${TEST_NAME_BASE}-run" cylc play "${WORKFLOW_NAME}" | ||
| cylc workflow-state "${WORKFLOW_NAME}//1/foo:started" --interval=1 | ||
| sleep 3 | ||
wxtim marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
ChrisPaulBennett marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # Test that the custom tail command is used when the task is live | ||
| TEST_NAME=${TEST_NAME_BASE}-cat-log-auto-tail | ||
| cylc cat-log "${WORKFLOW_NAME}//1/foo" -f o -m a > "${TEST_NAME}.out" | ||
ChrisPaulBennett marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| grep_ok "HELLO from foo 1" "${TEST_NAME}.out" | ||
| #------------------------------------------------------------------------------- | ||
| cylc stop --kill --max-polls=20 --interval=1 "${WORKFLOW_NAME}" | ||
| #------------------------------------------------------------------------------- | ||
| # Test that the custom tail command is not used when the task is not live | ||
| # (i.e., auto mode should not use the custom tail command) | ||
| TEST_NAME=${TEST_NAME_BASE}-cat-log-auto-cat | ||
| cylc cat-log "${WORKFLOW_NAME}//1/foo" -f o -m a > "${TEST_NAME}.out" | ||
| grep_fail "HELLO from foo 1" "${TEST_NAME}.out" | ||
| grep_ok "from foo 1" "${TEST_NAME}.out" | ||
ChrisPaulBennett marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| #------------------------------------------------------------------------------- | ||
| # Test that the custom tail command is not used when workflow logs are requested | ||
| # (i.e., auto mode should not use the custom tail command) | ||
| TEST_NAME=${TEST_NAME_BASE}-cat-log-auto-workflow | ||
| # Use the workflow name without the task ID to get the workflow logs | ||
| cylc cat-log "${WORKFLOW_NAME}" -m a > "${TEST_NAME}.out" | ||
ChrisPaulBennett marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| grep_fail "HELLO" "${TEST_NAME}.out" | ||
| grep_ok "$("Workflow: */functional/cylc-cat-log/14-auto-mode")" "${TEST_NAME}.out" | ||
| purge | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #!/usr/bin/env bash | ||
| # Modify 'tail' output to prove that cylc used the custom tailer. | ||
| # Exit immediately, for the test (i.e. don't 'tail -F') | ||
| FILE="$1" | ||
| tail -n +1 "${FILE}" | awk '{print "HELLO", $0; fflush() }' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| [scheduler] | ||
| [[events]] | ||
| abort on stall timeout = True | ||
| stall timeout = PT2M | ||
| [scheduling] | ||
| [[graph]] | ||
| R1 = foo | ||
| [runtime] | ||
| [[foo]] | ||
| script = """ | ||
| for I in $(seq 1 100); do | ||
| echo "from $CYLC_TASK_NAME $I" | ||
| sleep 1 | ||
| done | ||
| """ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.