-
Notifications
You must be signed in to change notification settings - Fork 27
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
Updated mpb bar progress bars #132
Updated mpb bar progress bars #132
Conversation
Hey @joereuss12, it looks like something that was changed is causing the Test action to throw this:
Can you investigate and let me know when you've patched things back up? |
@jhiemstrawisc just updated with some more changes too. I can undo the log level if needed depending on how Brian responds to the issue I made (#135) and I'll make a note in the issue to revert it back if needed. |
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.
The big item to focus on is how the EwmaIncrement
method should be invoked. It certainly looks wrong right now, always being called with 0.
The other items are mostly minor.
How do we test this functionality?
cmd/object_copy.go
Outdated
@@ -77,7 +77,7 @@ func copyMain(cmd *cobra.Command, args []string) { | |||
if val, err := cmd.Flags().GetBool("debug"); err == nil && val { | |||
setLogging(log.DebugLevel) | |||
} else { | |||
setLogging(log.ErrorLevel) |
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.
NACK on changing the error behavior as part of an unrelated PR.
handle_http.go
Outdated
progressBar.DecoratorEwmaUpdate(currentCompletedTime.Sub(previousCompletedTime)) | ||
previousCompletedTime = currentCompletedTime | ||
start := time.Now() | ||
progressBar.EwmaIncrement(time.Since(start)) |
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.
How is this supposed to work? The time.Since
is always, more-or-less, going to be zero here, right? How is it measuring progress?
handle_http.go
Outdated
startBelowLimit = time.Now().Unix() | ||
continue | ||
} else if (time.Now().Unix() - startBelowLimit) < slowTransferWindow { | ||
} else if (time.Now().Unix() - startBelowLimit) < int64(slowTransferWindow) { |
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.
Why is this necessary?
handle_http.go
Outdated
progressBar.Abort(true) | ||
log.Errorln("cancelled, too slow!") | ||
log.Info("retrying...") | ||
//cancelledProgressBar.SetTotal(resp.Size, true) |
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.
Isn't there a higher function that emits an error message? Seems strange to do that from the progress bar.
This fixes a bug when downloading from an origin for the first time and a weird error message shows up. Turns out the package needed some updating. This took some time since the function we originally had for v7 no longer existed in v8. Also changed around the styling a tad and made it look nice and work with this new version upgrade. Removed what I thought was an unnecessary extra bar being made to say "done". Also found a typo to be fixed within handle_http
Updated the code so progress bars work with tests. Also made a few more changes: 1. Updated messages/bar when download is taking too long, didn't see a point of making a whole new bar. Have a log.error saying "cancelled" and info saying "retrying" as well as abort the bar 2. Changed the log level for `object copy` to be log.Info, thought a more descriptive log would be good for users and is not displaying too much more info to where it would be annoying.
Updated progress bars per requests from PR. Made measuring progress actually work now (wasn't before) by calculating correct time and bytes that have progressed. Fixed a few leftover typos and changed up error messages to appear cleaner and give better worded info. The only issue: I could not get a logrus warning message to print with the progress bars. The bar would quickly override the message and would ususally end up outputting 2 bars instead of 1. My current fix: There is a function in the mpb package that allows you to write above the progress bars (but has to be a byte string). I could not figure out how to convert a logrus warning to a byte string to be outputted (if there even is a way). Therefore, I created a little warning to appear over the progress bar if the download is happening too slow. Even though it is not a logrus warning, I feel still helpful to know.
6186a3e
to
50d782b
Compare
This fixes a bug when downloading from an origin for the first time and a weird error message shows up. Turns out the package needed some updating. This took some time since the function we originally had for v7 no longer existed in v8. Also changed around the styling a tad and made it look nice and work with this new version upgrade. Removed what I thought was an unnecessary extra bar being made to say "done". Also found a typo to be fixed within handle_http.