-
Notifications
You must be signed in to change notification settings - Fork 94
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
Fix cylc clean while cat-log running #5359
Conversation
Needs rebasing onto 8.1.x. |
Thanks, however this partially addresses that issue. We need to check for other instances of logging that should be moved into the exception message |
Okay, I've removed the close from the description. |
Ah, just realised a slight flaw with only testing for Also annoying is how Anyway, we can sort these out in a follow-up issue. |
Co-authored-by: Ronnie Dutta <[email protected]>
Dammit, confirmed with this script: #!/usr/bin/env bash
set -eux
TD="$HOME/cylc-run/foo/log/scheduler"
mkdir -p "$TD"
TF="$TD/log"
echo -e 'a\nb\nc' > "$TF"
tree "$TD"
tail --follow=name -f "$TF" & PROC="$!"
sleep 2
# this will likely fail due to FS locking stuffs
rm -r "$TD" && echo 'REMOVE PASSED' || echo 'REMOVE FAILED'
rm -r "$TD" && echo 'REMOVE PASSED' || echo 'REMOVE FAILED'
rm -r "$TD" && echo 'REMOVE PASSED' || echo 'REMOVE FAILED'
# tidy up after
kill "$PROC"
rm -r "$TD" || true Which reliably gives:
Will play a little more but I think we need to add this code too. |
I used this script to double-check the premise that the tail process dies when the file is removed and to confirm the error message(s) returned: #!/usr/bin/env bash
set -eu
TD="$HOME/cylc-run/foo/log/scheduler"
mkdir -p "$TD"
TF="$TD/log"
echo -e 'a\nb\nc' > "$TF"
# NOTE: for some reason the tail command doesn't die when launched
# as a background process
echo 'Start you tail process now:'
echo "i.e. tail -f --follow=name '$TF'"
sleep 5
# retry removal a few times
SLEEP=1
for try in $(seq 1 10); do
sleep "$SLEEP"
echo "Try: $try"
rm -r "$TD" || continue
echo "Success after $((try * SLEEP)) seconds."
break
done
# tidy up after JIC
rm -r "$TD" 2>/dev/null || true This is hard to test, would need NFS in a container and whatnot so commenting it here for the record, will link this comment into the docstring. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works a charm for me.
$ cylc vip whatever
$ cylc cat-log whatever -m t
$ cylc clean -y whatever
Managed to work out a functional test after a little bodging, can bump that and the changelog to #5432 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested it out. Added a changelog entry
cylc clean
will fail when a cat-log process is keeping one of the log files open. This is a more pressing issue now that the log view is available in the gui.This is related to an nfs issue and may not be possible to reproduce on all systems.
The solution involves
--follow=name
, changed in the default.rmtree
behaviour, by retrying on error.closes #5341
Note for debugging this issue, I changed the error message to be passed into the gui.
To test, open the gui and open a log file. With the log view still open, clean the workflow.
This will error on master but not on this branch.
In the gui, I think we should maybe close any open views on clean, perhaps even redirect to the dashboard? But this would be a separate issue.
Check List
CONTRIBUTING.md
and added my name as a Code Contributor.setup.cfg
andconda-environment.yml
.CHANGES.md
entry included if this is a change that can affect users?.?.x
branch.