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

Show download progress for the Preload Tarball #9740

Closed
blueelvis opened this issue Nov 19, 2020 · 9 comments · Fixed by #9752
Closed

Show download progress for the Preload Tarball #9740

blueelvis opened this issue Nov 19, 2020 · 9 comments · Fixed by #9752
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. kind/ux priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@blueelvis
Copy link
Contributor

image

As you can see in the above screenshot, we don't show the progress of the download. It is missing the bandwidth, size of remaining content, ETA etc. like we show for the ISO.

Since this preload tarball is big, the above information is essential.

@blueelvis blueelvis added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/ux labels Nov 19, 2020
@afbjorklund afbjorklund added kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence. labels Nov 20, 2020
@afbjorklund
Copy link
Collaborator

afbjorklund commented Nov 20, 2020

We have the same problem for the kicbase: #7012 (but it uses a different library, so will need a different fix)

@afbjorklund
Copy link
Collaborator

We're using the same library and the same storage for both, so it must be something else ?

@afbjorklund
Copy link
Collaborator

The responses look similar enough:

curl --head https://storage.googleapis.com/minikube/iso/minikube-v1.15.0.iso?checksum=file:https://storage.googleapis.com/minikube/iso/minikube-v1.15.0.iso.sha256
HTTP/2 200
...
accept-ranges: bytes
content-length: 189796352
...
curl --head https://storage.googleapis.com/minikube-preloaded-volume-tarballs/preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4

HTTP/2 200
...
accept-ranges: bytes
content-length: 509973850
...

@afbjorklund
Copy link
Collaborator

afbjorklund commented Nov 20, 2020

The pb library omits the progress bar, when the file name is too long (for the terminal).

80
> preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 112.34 MiB
180
> preloaded-images-k8s-v6-v1.19.4-docker-overlay2-amd64.tar.lz4: 205.77 MiB / 486.35 MiB [----------------------->________________________________] 42.31% 38.59 MiB p/s ETA 7s

So the downloaded filename needs to be truncated (...), before it is used for the progress bar.

@afbjorklund
Copy link
Collaborator

afbjorklund commented Nov 20, 2020

In order to also show the actual progress bar, we need to stay below 15 characters. Otherwise it won't fit.
This does not really give us space to show the file name. For instance, "minikube-v1.15.0.iso" is 20...

💿  Downloading VM boot image ...
    > minikube-v1.15.0.iso.sha256: 65 B / 65 B [-------------] 100.00% ? p/s 0s
    > minikube-v1.15.0.iso: 181.00 MiB / 181.00 MiB [] 100.00% 33.18 MiB p/s 5s
👍  Starting control plane node minikube in cluster minikube

One approach would be to use two lines, and then display the full filename and a full progress bar.
Or use a less avanced library, that would offer more options to display all the information available ?

@blueelvis
Copy link
Contributor Author

Maybe we could just omit that information from the main output but show the full name in the verbose logs?

@afbjorklund
Copy link
Collaborator

afbjorklund commented Nov 20, 2020

I would like to show a little information. Currently docker doesn't show anything, and it is a bit annoying.

👍  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...

It just stays forever at that tractor, doesn't even show "gcr.io/k8s-minikube/kicbase:v0.0.14" or anything.

@afbjorklund
Copy link
Collaborator

afbjorklund commented Nov 20, 2020

And we do show the URL in the logs already.

That > looks a bit odd with all the emoji, too...

The rest of minikube interface is more like this:

https://jamiemaison.github.io/react-emoji-progress-bar/

@afbjorklund
Copy link
Collaborator

afbjorklund commented Nov 21, 2020

Maybe we could just omit that information from the main output but show the full name in the verbose logs?

Example output:

😄  minikube v1.15.1 on Ubuntu 20.04
✨  Using the virtualbox driver based on existing profile
💿  Downloading VM boot image ...
    181.00 MiB / 181.00 MiB [------------------------] 100.00% 30.54 MiB p/s 6s
👍  Starting control plane node minikube in cluster minikube
🔥  Creating virtualbox VM (CPUs=2, Memory=6000MB, Disk=20000MB) ...

Very easy to implement, at least

@ -41,13 +41,16 @@ type progressBar struct {
 // display the progress of stream until closed.
 // total can be 0.
 func (cpb *progressBar) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser {
+       if strings.HasSuffix(src, "sha256") {
+               return stream
+       }
        cpb.lock.Lock()
        defer cpb.lock.Unlock()
        if cpb.progress == nil {
                cpb.progress = pb.New64(totalSize)
        }
        p := pb.Full.Start64(totalSize)
-       p.Set("prefix", "    > "+filepath.Base(src+": "))
+       p.Set("prefix", "    ")
        p.SetCurrent(currentSize)
        p.Set(pb.Bytes, true)
 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. kind/ux priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants