Skip to content
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

Merged
merged 5 commits into from
Sep 28, 2023

Conversation

joereuss12
Copy link
Contributor

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.

@joereuss12 joereuss12 added this to the v7.1.0 milestone Sep 13, 2023
@joereuss12 joereuss12 linked an issue Sep 13, 2023 that may be closed by this pull request
@jhiemstrawisc
Copy link
Member

Hey @joereuss12, it looks like something that was changed is causing the Test action to throw this:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x8115ec]

Can you investigate and let me know when you've patched things back up?

@joereuss12
Copy link
Contributor Author

@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.

Copy link
Collaborator

@bbockelm bbockelm left a 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?

@@ -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)
Copy link
Collaborator

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))
Copy link
Collaborator

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 Show resolved Hide resolved
handle_http.go Outdated Show resolved Hide resolved
handle_http.go Outdated
startBelowLimit = time.Now().Unix()
continue
} else if (time.Now().Unix() - startBelowLimit) < slowTransferWindow {
} else if (time.Now().Unix() - startBelowLimit) < int64(slowTransferWindow) {
Copy link
Collaborator

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)
Copy link
Collaborator

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.

@joereuss12 joereuss12 requested a review from bbockelm September 21, 2023 15:11
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.
@bbockelm bbockelm force-pushed the update-progress-bars-branch branch from 6186a3e to 50d782b Compare September 26, 2023 12:44
@bbockelm bbockelm merged commit 13ea982 into PelicanPlatform:main Sep 28, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Weird error message for object copy a file from staging
3 participants