canonical / ubuntu-pro-client

Ubuntu Pro Client for offerings from Canonical
https://canonical-ubuntu-pro-client.readthedocs-hosted.com/en/latest/
GNU General Public License v3.0
52 stars 73 forks source link

Improve progress reporting during apt updates #715

Open OddBloke opened 5 years ago

OddBloke commented 5 years ago

During the UX review, it was noted that just emitting "This could take some time" is the worst way of signalling progress to users. The potential better ways of doing this, in order of desirability, are:

  1. semi-accurate time estimate, e.g. “(~30 s remaining…)”
  2. completed/total counts, e.g. “(3/11)”
  3. completed-only count, e.g. “(3 done…)”
  4. name the current item (e.g. “(ubuntu-cisbenchmark-foo…)”
  5. a spinner (e.g. ◴◷◶◵)
  6. no progress feedback at all (e.g. “this will take some time”)

This issue is to determine the path we want to take.

OddBloke commented 5 years ago

So things are substantially complicated by the fact that we hand off to apt-get to perform the whole time-consuming action, so as things stand it's largely a black box to us. Without any granularity of data, I think the best we can do is "5. a spinner".

OddBloke commented 5 years ago

I spoke with @julian-klode on IRC yesterday about our options, here is a (lightly edited) transcript:

<@Odd_Bloke> juliank: For the UA client, we are being asked if we can improve the progress feedback during the installation of packages; do you have any suggestions of how we could interact with apt to do this?
<juliank> Odd_Bloke: what does it do now? does it even let apt print progress?
<@Odd_Bloke> juliank: It just says "this could take a while" and then prints something out after apt is complete.
<juliank> ok
<@Odd_Bloke> So nothing, really.
<juliank> So why not show the apt output?
<juliank> I think there are also some progress fds for install, but not for download IIRC
<juliank> if you want full UI control, you'd have to go via python-apt and implementing progress classes
<@Odd_Bloke> juliank: Do you know of any examples of that python-apt use that I could take a look at?
<@Odd_Bloke> (Not looking for you to do any work here, this is probably low on our list of priorities!)
<juliank> Odd_Bloke: Not really
<@Odd_Bloke> OK, thanks for the help!
<juliank> Odd_Bloke: It's basically apt.Cache(); for name in names: cache[name].mark_install(); and then cache.commit()
<juliank> commit() takes two arguments
<juliank> https://apt-team.pages.debian.net/python-apt/library/apt.cache.html#apt.cache.Cache.commit
<juliank> The documentation is broken
<juliank> You can subclass AcquireProgress and InstallProgress in https://apt-team.pages.debian.net/python-apt/library/apt.progress.base.html
<juliank> or use existing text ones: https://apt-team.pages.debian.net/python-apt/library/apt.progress.text.html

To summarise: there isn't much we can do using the apt-get command line (other than perhaps scrape the data or pass it through verbatim to the user), and we would need to transition to using python-apt to do anything more complex.

matthewpaulthomas commented 5 years ago

Alas. So, a spinner then? (See halo and yaspin for example.)

If activating a UA service is something you do only once or twice in the life of a system, and it’s not time-critical, it may be worthwhile for the operation to take a bit longer for the sake of having more informative progress. So I’ll repeat here my other suggestion, of doing apt-get install --download-only first, so that you can output something like

Installing FIPS packages: ◐ Downloading…

and then during the real apt-get install replacing that line with

Installing FIPS packages: ◒ Installing…
OddBloke commented 5 years ago

Thank you mpt, apologies for not capturing that here!

orndorffgrant commented 2 years ago

Tracking in SC-1155