Repository navigation
feat(plugin:dashboard): redraw the screen at least once a second - #755
Merged
Merged
Conversation
The screen was only redrawn on events, so the elapsed time and the ETA stood still during a long task. A daemon thread now redraws it when no event did so for a second. The screen is written with os.write() straight to the file descriptor instead of through sys.stdout: Ansible forks its workers while the thread may be drawing, Modules/_io/bufferedio.c does not reset the buffer lock after a fork, and multiprocessing flushes the std streams at the end of each worker, which would hang on a lock held at fork time. Stress-tested with a 10 ms interval, 30 hosts, 40 tasks and 10 forks on ansible-core 2.16 and 2.18.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The dashboard screen was only redrawn on events (task start, host results), so the elapsed time and the ETA stood still during a long task. A daemon thread now redraws it when no event did so for a second.
The screen is written with
os.write()straight to the file descriptor: Ansible forks its workers while the thread may be drawing, and a fork while the thread holds the lock of thesys.stdoutbuffer would leave the worker hanging when it flushes its streams at exit (Modules/_io/bufferedio.cdoes not reset that lock after a fork).Tested with ansible-core 2.16, 2.18 and 2.22 (unit tests, including a 3-second task during which the clock has to move on), and stress-tested with a 10 ms redraw interval, 30 hosts, 40 tasks and 10 forks.
🤖 Generated with Claude Code