Skip to content

[23.0 backport] improve cp progress - #4157

Merged
thaJeztah merged 6 commits into
docker:23.0from
cpuguy83:23.0_improve_cp_progress
Apr 5, 2023
Merged

[23.0 backport] improve cp progress#4157
thaJeztah merged 6 commits into
docker:23.0from
cpuguy83:23.0_improve_cp_progress

Conversation

@cpuguy83

Copy link
Copy Markdown
Collaborator

Cherry-picks #4137

This fixes a case where a non-tty will have control characters + the log
line for every single read operation.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit f27927d)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
- Instead of rewriting the entire line every time only clear and write
the parts that changed.
- Hide the cursor while writing progress
Both these things make the progress updates significantly easier to
read.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit ccae6e9)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This just makes it easier to reason about what is happening.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit efd011b)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Only show progress updates after a time threshold has elapsed in order
to reduce the number of writes to the terminal.
This improves readability of the progress.
Also moves cursor show/hide into the progress printer to reduce chances
if messing up the user's terminal in case of cancellation.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 90b7bc3)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit b9a1b09)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This moves all the terminal writing to a goroutine that updates the
terminal periodically.
In our MITM copier we just use an atomic to add to the total number of
bytes read/written, the goroutine reads the total and updates the
terminal as needed.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit eb392ff)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@cpuguy83cpuguy83 added kind/bugfix PR's that fix bugs area/ux labels Apr 3, 2023
@cpuguy83cpuguy83 added this to the 23.0.3 milestone Apr 3, 2023
@thaJeztahthaJeztah changed the title 23.0 improve cp progress[23.0 backport] improve cp progressApr 4, 2023

@thaJeztahthaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztahthaJeztah modified the milestones: 23.0.3, 23.0.4Apr 4, 2023
@thaJeztah
thaJeztah merged commit 683b099 into docker:23.0Apr 5, 2023
@cpuguy83
cpuguy83 deleted the 23.0_improve_cp_progress branch April 17, 2023 17:43
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@cpuguy83@thaJeztah@vvoland