-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Add progress-bar to common/step_download.go #5851
Add progress-bar to common/step_download.go #5851
Conversation
57c6f91
to
cfabf1c
Compare
cfabf1c
to
9d4583d
Compare
Re-based onto master. |
Created issue #5903 for this PR. |
9d4583d
to
2e7633b
Compare
Travis-CI failed when running tests against go 1.9.x due to a connection error and thus this might need to be resetted ( Is there still interest in this PR? If so I can rebase to fix the conflict. |
For now let's leave it open but not spend time fixing it up -- I'm still chugging along through replacing our download code and don't want you to duplicate work. Sorry it's taking so long. |
kk. no worries. |
You know what? The go-getter replacement is taking me forever. If you want to rebase this, I'll merge it for the 1.3 release. |
ok, sure. |
b19b434
to
ca543eb
Compare
kk. it's been rebased. I haven't tested this in a while (and won't be able to as we're approaching the end of a quarter), but nothing significant has really changed so the only difference that you should see is the packer progress-bar being replaced with cheggaaa's progress-bar. if you want to customize the way the progress-bar looks, there's a function in again, this progress-bar only works for downloading stuff as it's based on the work I did earlier converting the downloaders to use goroutines. if a similar interface comes out for uploading across the different builders, I can look at integrating a progress-bar there too. |
In reference to the delays with go-getter, should I re-open PR #5849 (and rebase it) for FTP support? |
Let's leave the FTP support one alone for now (reason being, if I DO implement go-getter, that'd be a regression since I don't believe go-getter supports FTP either.) . I'll test this PR soon and merge it when 1.3 rolls closer. |
This doesn't seem to actually make a progress bar:
|
If I cancel the download, then the progress bar appears:
|
Yea, sorry. Progress-bar was probably not the correct term to submit this PR as. When I took the suggestion, I really only cared about the progress rate and set the width too small (25) so it doesn't render it due to the bit transfer rate occupying most of that width. Plus, I'm not sure how to determine the console width to set a reasonable size as the console between windows and posix are both vastly different (no terminal escape codes). That function that I mentioned lets you customize how you guys would want it to look, though. I can fiddle with it, but it's purely aesthetic and I won't be able to get to it until I finish this other thing I'm working on. I suppose it's up to the community how they'd want the progress bar to look. If you don't care, you can just empty out that GetDefaultProgressBar, and then it'll look like the following: https://github.com/cheggaaa/pb. But then you get no bit transfer rate which I think is more valuable information. |
Hmm. I guess I'd misunderstood the status and intention of this PR, then. I don't think we're gaining that much with this PR over the current download UI, and if all you care about is displaying the rate we can get that without adding a new dependency. I'm going to close this after all. Sorry for dragging this out so long. |
Um. If you want a progress-bar it's literally setting a number from 25 to 80 (or 132). I'm pretty much just letting you know how to tweak the apperance, but if you're against the progress status. Tell me how you want me to make it look. Do you want '....complete!', or '====}', or '----->', etc. The current progress UI only shows the estimated percentage of completion and not the transfer rate. This was one of the reasons why my previous patch to common/download.go added protocol transfers using goroutines. Plus, this dep is usable for all types of transfers. |
…o the conversation on PR hashicorp#5851.
ok. I set the progress bar wider for you and put it into its own file so its more obvious that it can (and should) be tweaked. Also added it to the upload/download for the file provisioner. If you care, I can re-submit the PR. Showing the amount of data transferred is significant sensor when troubleshooting network performance issues such as this winrmcp issue that you guys have been sitting on for a bit. If you really don't care about having a progress-bar in packer, fine. But keep in mind that a progress-bar has been asked about for the past year now. So please take the time to finally add one. I don't make a living being a programmer or writing golang or anything like y'all do (I don't even use DevOps shit for that matter!) so it's not easy for me to take the time to write these things up and then fight to get them merged upstream like I've had to do with pretty much all the patches I've submitted. |
it's a real shame that we can't go with our elegant solution as I've gotten kind of attached to the way it turned out after we refactored it. but yea, i'm totally down with your suggestion. i haven't gotten a chance to look at your commits yet, but i'm totally down with calculating the name length and maybe leaving a comment to notify any devers that the progressbar length calculation is tied to any extra text that a We can probably also calculate the length of |
Yeah I'm sad about it too. Attaching it to the UI did seem more "beautiful" in theory; but ultimately changing the interface is probably not worth it because it'll break third party plugins for just a little extra debugging information and cosmetic change. 😢 |
dc0c2d1
to
2bea3ed
Compare
…o the conversation on PR hashicorp#5851.
edaced3
to
a1f8eb5
Compare
…o the conversation on PR hashicorp#5851.
ok. rebased it. went through another refactor to move things from packer.Ui back into common. split up terminal-specific code in case someone wants to extend it later. added tests for everything, and also incorporated your hack. I don't have osx to test it, but it seems to work on my systems. lmk if there's anything else. |
@@ -102,33 +102,33 @@ func (v VagrantCloudClient) Delete(path string) (*http.Response, error) { | |||
} | |||
|
|||
func (v VagrantCloudClient) Upload(path string, url string) (*http.Response, error) { | |||
file, err := os.Open(path) |
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.
These changes don't seem related to the progress bar change.
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.
yea. you're right. i'll find which commit added this and remove it.
you might want to fix this tho as it's a file handle leak.
vendor/vendor.json
Outdated
{ | ||
"checksumSHA1": "X2/71FBrn4pA3WcA620ySVO0uHU=", | ||
"path": "github.com/creack/goselect", | ||
"revision": "528c74964609a58f7c17471525659c9b71cd499b", | ||
"revisionTime": "2018-02-10T03:43:46Z" | ||
}, | ||
{ | ||
"checksumSHA1": "/5cvgU+J4l7EhMXTK76KaCAfOuU=", | ||
"checksumSHA1": "Lf3uUXTkKK5DJ37BxQvxO1Fq+K8=", |
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.
is this change necessary? When I build locally it seems to be updating itself to a different SHA: "checksumSHA1": "dvabztWVQX8f6oMLRyv4dLH+TGY=",
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.
ok, it's from a failed revert since this was originally from like forever ago. rm'ing it.
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.
Okay apart from the two very minor questions below I think we're good. Finally 😅Thanks for bearing with me through this headache. Do you think you can squash so we have a cleaner history without quite as many commits coming into this one merge?
07d610d
to
40b9fed
Compare
…added some missing arguments that were missed during the rebase. Modified the default progress bar's width to 80 as a result of the conversation onf PR hashicorp#5851.
40b9fed
to
0faf58a
Compare
…added some missing arguments that were missed during the rebase. Modified the default progress bar's width to 80 as a result of the conversation onf PR hashicorp#5851.
0faf58a
to
46b06eb
Compare
…added some missing arguments that were missed during the rebase. Modified the default progress bar's width to 80 as a result of the conversation on PR hashicorp#5851.
…th using the minimum length from a packer.UI and the terminal dimensions via kernel32.GetConsoleScreenBufferInfo or an ioctl (TIOCGWINSZ) to "/dev/tty".
…actored it so that the terminal width is calculated based on each interface which returns a custom progressbar specific to its ui.
…e packer.Ui implementations. Split up the terminal-related functions into a separate terminal.go and calculate the progress bar width by traversing through packer.Ui to avoid the issue with github.com/ugorji/go/codec serializing private members (or unsafe pointers) of structs. Shuffled some arguments around in getConsoleScreenBufferInfo in common/terminal_windows.go so that the interface forces the user to correctly declare a _CONSOLE_SCREEN_BUFFER_INFO type.
…with packer.rpc.Ui not exporting any information about what it's doing to anybody.
46b06eb
to
cf9bbe3
Compare
ok, it got pretty confusing during the rebase due to that revert of the rename from "CopyFile" to "inPlace" PR. but, I squashed out all the worthless commits, so it's down to just the 1 revert, the 3 major refactors and the vendor.json updates (7). i'd like to retain some of this history (since this branch is tied to the fork in my gh acct), so if you want me to squash them all down to 1 to erase all of it, i'll probably need to re-submit the PR w/ a different branch. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This was based on PR #2906 and so had to be delayed until that was merged upstream.
This adds a progress-bar to step_download.go using the progressbar implementation at http://github.com/cheggaaa/pb that was suggested on an earlier issue.
The progress-bar's appearance was consolidated into a function so that it can be changed to look however you guys want. It's currently been specified to provided the same information as the previous download ticker as well as including the number of b/mb/gb that have been xferred.
This also removes the previous
PercentProgress
ticker as it's been superceded by this progressbar.Closes #6068