Skip to content

Conversation

@ttaylorr
Copy link
Contributor

@ttaylorr ttaylorr commented Jan 6, 2018

This pull request adopts the recommendation for a new style of progress meter proposed by @bitinn and @technoweenie in #2802, and #2802 (comment), respectively:

Would it be possible to change the meter to [Uploading | Downloading] LFS objects: 100% (63/63), 2.01 MiB | 280.00 KiB/s, done. That matches the "Writing objects" message, retains the file counts, and even shows current speed.

The style that is implemented in this pull request is exactly as @technoweenie's recommendation above:

~/example-repository (master) $ git lfs pull
Downloading LFS objects: 100% (501/501), 1.9 KB | 210 B/s, done

Here's a large overview of the changes:

  1. Remove the notion of 'skipped' files. This term has been used to indicate files that are unnecessary to re-transfer, for they are already present on either the client (in the case of a fetch) or the server (in the case of a push). This term has unfortunately also been the source of some confusion by users. To remove this source of confusion, let's instead treat "skipped" files as already having been transferred, and instead of incrementing a "skipped" count, simply increment the number of files and bytes as already having been transferred, without affecting the true transfer speed.

  2. Introduce a transfer rate indicator. To match the style of progress meter used by Git to indicate push/pull operations, introduce to Git LFS's progress meter the average rate at which the transfer is occurring.1 To keep track of this, each time we receive a read update, we first check if it has been sufficiently long enough since the last time we calculated an average (to avoid a false sense of precision) and, if so, recalculate the average rate of transfer by using a Cumulative Moving Average (C.M.A) function, so as to weight more heavily recent transfer speeds, so that they dominate the average.

The average is calculated as:

mathtex

Where:

  • avg is the average rate of transfer (given as bytes/second)
  • n is the number of samples taken
  • s is the number of bytes transferred since the last sample was taken
  • d is the duration of time that has passed since the last sample

I am hoping that this new formatting will clarify what is going on when LFS uploads and downloads objects. The majority of this pull request is changing outdated assertions in the integration suite to match the new formatting.

Closes: #2802.

1: This is actually something that I've been wanting to add to LFS for some time now, but haven't found the right time to do it. I have published this Gist around a year ago at the time of writing this pull request. That code was originally intended for something exactly like this.

/cc @git-lfs/core #2802

@ttaylorr ttaylorr added the review label Jan 6, 2018
@ttaylorr ttaylorr added this to the v2.4.0 milestone Jan 6, 2018
@ttaylorr ttaylorr requested a review from technoweenie January 6, 2018 03:07
Copy link
Contributor

@technoweenie technoweenie left a comment

Choose a reason for hiding this comment

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

Looks great. 1 super minor nit.

tq/meter.go Outdated
// TransferBytes increments the number of bytes transferred
func (m *Meter) TransferBytes(direction, name string, read, total int64, current int) {
now := time.Now()

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd put this under the if m == nil check, since nothing happens with now before that return.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. I was wavering on this when writing the patch, and left it at the top because I had convinced myself that waiting until after the if would introduce imprecision in the averaging. While probably true to a degree, I'm sure that the effect is negligible, and the code would be more readable if the "first thing" that is supposed to happen came after the nullity check. Changed in cf8d827.

@ttaylorr ttaylorr merged commit d1cd726 into master Jan 17, 2018
@ttaylorr ttaylorr deleted the new-progress-design branch January 17, 2018 23:19
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Nov 17, 2020
Since commit df2007d in PR git-lfs#646
it appears that the push_all_setup() helper function has
accidentally short-circuited all but the first test calling it
by exiting early with an exit code of 0 when the test repo exists.
The calling tests thus appear to pass but are instead skipping all
of their actual test logic.

The original intent appears to have been to reuse a single
test repo for the set of related tests of the --all push option.
However, these tests do not leave the repo state in the same
condition created by push_all_setup(), e.g., they replace the
"origin" remote, and most importantly they each remove an LFS
object file.  Thus simply replacing "exit 0" with "return 0"
in push_all_setup() is insufficient.

To simplify matters, we no longer try to reuse the test repos
between tests.  Rather, we let push_all_setup() create a unique
test repo for each caller by appending the distinct suffix
argument provided by the caller to the name of the test repo.

We then have to account for the fact that these tests have
not fully run in some time, and therefore missed changes like
commit db4e3b2 in PR git-lfs#2811
which updated the Git LFS progress meter output format.

Several calls to "git push" also need adjustment to avoid
errors such as "--all can't be combined with refspecs" and
"tag shorthand without <tag>", and one short-circuited test
had an incorrect count of "push ... => file1.dat" lines which
we revise.
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Sep 10, 2024
In commit db4e3b2 of PR git-lfs#2811 in 2018
we updated the progress meter text of Git LFS from "Git LFS" to the
more explicit "Uploading LFS objects" or "Downloading LFS objects".
A large number of were changed at this time to check for the revised
text strings in the output logs the capture from Git and Git LFS
operations.

However, the "cloneSSL" test in our t/t-clone.sh test script was not
updated because it does not actually run to completion, due to a
long-standing bug in the conditional used to check the TRAVIS
variable.  As described in git-lfs#5658, the test instead always exits
early and declares success.

We expect to address this problem in a subsequent commit in this PR,
so we first update the test to check for the same progress meter
text as all our other tests, which will help ensure it succeeds
once it is fully enabled.

We also take the opportunity to add a similar check of the same
progress meter message to the "clone ClientCert" test.  This brings
our tests into slightly closer alignment with each other, which
should help ensure they stay consistent in the future.  (Note that
this test also does not run to completion at the moment, for the
same reason as the "cloneSSL" test.)
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Sep 15, 2024
In commit db4e3b2 of PR git-lfs#2811 in 2018
we updated the progress meter text of Git LFS from "Git LFS" to the
more explicit "Uploading LFS objects" or "Downloading LFS objects".
A large number of were changed at this time to check for the revised
text strings in the output logs the capture from Git and Git LFS
operations.

However, the "cloneSSL" test in our t/t-clone.sh test script was not
updated because it does not actually run to completion, due to a
long-standing bug in the conditional used to check the TRAVIS
variable.  As described in git-lfs#5658, the test instead always exits
early and declares success.

We expect to address this problem in a subsequent commit in this PR,
so we first update the test to check for the same progress meter
text as all our other tests, which will help ensure it succeeds
once it is fully enabled.

We also take the opportunity to add a similar check of the same
progress meter message to the "clone ClientCert" test.  This brings
our tests into slightly closer alignment with each other, which
should help ensure they stay consistent in the future.  (Note that
this test also does not run to completion at the moment, for the
same reason as the "cloneSSL" test.)
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Oct 7, 2024
In commit db4e3b2 of PR git-lfs#2811 in 2018
we updated the progress meter text of Git LFS from "Git LFS" to the
more explicit "Uploading LFS objects" or "Downloading LFS objects".
A large number of were changed at this time to check for the revised
text strings in the output logs the capture from Git and Git LFS
operations.

However, the "cloneSSL" test in our t/t-clone.sh test script was not
updated because it does not actually run to completion, due to a
long-standing bug in the conditional used to check the TRAVIS
variable.  As described in git-lfs#5658, the test instead always exits
early and declares success.

We expect to address this problem in a subsequent commit in this PR,
so we first update the test to check for the same progress meter
text as all our other tests, which will help ensure it succeeds
once it is fully enabled.

We also take the opportunity to add a similar check of the same
progress meter message to the "clone ClientCert" test.  This brings
our tests into slightly closer alignment with each other, which
should help ensure they stay consistent in the future.  (Note that
this test also does not run to completion at the moment, for the
same reason as the "cloneSSL" test.)
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Oct 9, 2024
In commit db4e3b2 of PR git-lfs#2811 we
updated the progress meter text of the Git LFS client from "Git LFS"
to the more explicit "Uploading LFS objects" or "Downloading LFS
objects".  A large number of tests were changed in the same commit
because they check the progress meter output in logs they capture
from Git LFS operations.

However, the "cloneSSL" test in our t/t-clone.sh test script was not
updated because it has not actually run to completion for a long time,
as described in git-lfs#5658, so it did not fail when the progress meter text
changed.  Due to a bug in the conditional used to check the TRAVIS
variable, the test instead always exits early and declares success.

We will address this problem in a subsequent commit in this PR,
at which point the test will fail unless we adjust it to check
for the same progress meter text as all our other tests, so we do
that now.

We also take the opportunity to add a similar check of the same
progress meter message to the "clone ClientCert" test.  This brings
our tests in the t/t-clone.sh script into slightly closer alignment
with each other, which should help ensure they stay consistent in
the future.  (Note that this test does not run to completion at the
moment either, for the same reason as the "cloneSSL" test.)
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Oct 9, 2024
In commit db4e3b2 of PR git-lfs#2811 we
updated the progress meter text of the Git LFS client from "Git LFS"
to the more explicit "Uploading LFS objects" or "Downloading LFS
objects".  A large number of tests were changed in the same commit
because they check the progress meter output in logs they capture
from Git LFS operations.

However, the "cloneSSL" test in our t/t-clone.sh test script was not
updated because it has not actually run to completion for a long time,
as described in git-lfs#5658, so it did not fail when the progress meter text
changed.  Due to a bug in the conditional used to check the TRAVIS
variable, the test instead always exits early and declares success.

We will address this problem in a subsequent commit in this PR,
at which point the test will fail unless we adjust it to check
for the same progress meter text as all our other tests, so we do
that now.

We also take the opportunity to add a similar check of the same
progress meter message to the "clone ClientCert" test.  This brings
our tests in the t/t-clone.sh script into slightly closer alignment
with each other, which should help ensure they stay consistent in
the future.  (Note that this test does not run to completion at the
moment either, for the same reason as the "cloneSSL" test.)
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Oct 29, 2024
In commit db4e3b2 of PR git-lfs#2811 we
updated the progress meter text of the Git LFS client from "Git LFS"
to the more explicit "Uploading LFS objects" or "Downloading LFS
objects".  A large number of tests were changed in the same commit
because they check the progress meter output in logs they capture
from Git LFS operations.

However, the "cloneSSL" test in our t/t-clone.sh test script was not
updated because it has not actually run to completion for a long time,
as described in git-lfs#5658, so it did not fail when the progress meter text
changed.  Due to a bug in the conditional used to check the TRAVIS
variable, the test instead always exits early and declares success.

We will address this problem in a subsequent commit in this PR,
at which point the test will fail unless we adjust it to check
for the same progress meter text as all our other tests, so we do
that now.

We also take the opportunity to add a similar check of the same
progress meter message to the "clone ClientCert" test.  This brings
our tests in the t/t-clone.sh script into slightly closer alignment
with each other, which should help ensure they stay consistent in
the future.  (Note that this test does not run to completion at the
moment either, for the same reason as the "cloneSSL" test.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants