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

Display progress bar on "interactive" (not CI) command line restore #4346

Open
natemcmaster opened this issue Jan 20, 2017 · 23 comments
Open
Labels
Area:Logging Functionality:Restore Partner:MSBuild Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Resolution:BlockedByExternal Progress on this task is blocked by an external issue. When that issue is completed this can proceed Type:Feature
Milestone

Comments

@natemcmaster
Copy link

From @natemcmaster on January 20, 2017 17:33

Steps to reproduce

Get slow internet.
Clear nuget caches.
dotnet new.
Add dependencies to lots of packages not in the first-run cache warmup. This can be done in a simple app by adding a bunch of rids to <RuntimeIdentifiers>.
dotnet restore.

Expected behavior

Show some sign of progress while downloading from the network. A spinner would be great, but even just confirmation that restore has begun would be helpful.

Actual behavior

No console output appears until NuGet is almost done with the restore. In the screenshot below, restore took over a minute (85 seconds). There was not console output until about 75 seconds after restore began

screenshot

Environment data

dotnet --info output: using 1.0.0-rc3

cc @shanselman @blackdwarf

Copied from original issue: dotnet/cli#5406

@emgarten
Copy link
Member

emgarten commented Jan 21, 2017

Restore previously solved this by writing out GET messages to let the user know what activity was taking place, however this is now hidden by default which causes users to once again think that NuGet is hung.

Previous issue: https://github.com/dotnet/cli/issues/1623

The logging for dotnet restore is done by an MSBuild task. I don't know if it is possible to create a spinner by logging through the MSBuild logger.

@blackdwarf
Copy link

blackdwarf commented Jan 21, 2017

Spinners will not work for CLI scenarios, however ASCII progress bars would. 😄 @natemcmaster do you see enough info if you pass in -v normal?

@shanselman
Copy link

@blackdwarf I see spinners all the time. https://github.com/sindresorhus/cli-spinners Or at the least, yes, progress like NPM.

@blackdwarf
Copy link

@shanselman that was a joke on my part. But, anyway, the main point is, does changing the verbosity influence this?

@shanselman
Copy link

I would have to test again. Point is, under fairly typical networking conditions (this was 3Mbs, consistently) we still saw a LONG pause with no feedback. You gotta show something. ...... dots....something.

@shanselman
Copy link

Just checked it @blackdwarf. I have 35Mbs here. Did -v but still waited around for a WHILE with no feedback.
image

@rrelyea
Copy link
Contributor

rrelyea commented Jan 24, 2017

can we log a dot, w/ no "\n", for each get? or something like that?

@blackdwarf
Copy link

The fact that normal verbosity doesn't influence this is pretty bad. @rrelyea back in the day, nuget client used to have a verbosity setting for this. Did we remove that?

In lack of that, I think that any output would be good. We could, I think, do a progress bar? Unless there is some limitation in the MSBuild loggers?

@emgarten
Copy link
Member

nuget client used to have a verbosity setting for this. Did we remove that?

The verbosity level is still there. dotnet restore is explicitly calling msbuild /t:Restore with a less verbose level.

A progress bar is difficult because restore downloads/discovers packages as it walks to be as efficient as possible, it doesn't know if there will be zero or a hundred packages downloaded until the end.

Restore should have a great progress experience from the console, I'm just not sure what is possible given the way restore works and the limitations of the MSBuild logger.

@blackdwarf
Copy link

@emgarten I see...is there a mapping between restore verbosity levels and MSBuild ones?

OK, so nix the progress bar idea. A series of dots as @rrelyea suggested would be good then I guess?

@emgarten
Copy link
Member

Dots could work. In the restore task NuGet knows the msbuild verbosity. It could convert lower level messages that it isn't going to display into dots.

@rrelyea
Copy link
Contributor

rrelyea commented Jan 25, 2017

feedback from @DoRonMotter

  • keep diag output a superset of normal build output...so log parsers don't get confused.
  • pushing to 4.0.1 as this doesn't currently meet the bar.

@rrelyea rrelyea modified the milestones: 4.0.1, 4.0 RTM Jan 25, 2017
@shanselman
Copy link

I'd also point out that "it's hard to do async progress bars" isn't really fair. Docker and npm and Yarn have nice ones.
image

@zhili1208 zhili1208 modified the milestones: Future-0, Backlog Nov 9, 2017
@zhili1208 zhili1208 added the Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. label Nov 9, 2017
@ghost
Copy link

ghost commented Apr 15, 2018

A docker like progress bar with transmission rate / total size is actually quite useful. Here is a sample code to make a simple spinner https://blogs.msdn.microsoft.com/brada/2005/06/11/showing-progress-in-a-console-windows/.

that or windows 98 drumsticks
The Windows 98 Drums

@gbaydin
Copy link

gbaydin commented Jun 28, 2020

Hello, I was wondering whether there has been any progress in adding a simple progress bar to dotnet restore. We're currently working on machine learning code (DiffSharp, TorchSharp) that depend on very large nuget packages (some GBs) that hold CUDA binaries, for example the following package and its dependencies:

https://www.nuget.org/packages/libtorch-cuda-10.2/

and the user experience of dotnet restore is not great because it "hangs" for long periods of time (say, half an hour in my average broadband home connection in the UK) without showing any indication of what is going on. Similar workflows in other ecosystems (say, Python pip, conda etc., or Docker) show progress information during package download showing the progress for the file currently being downloaded, download speed, ETA, etc. I think dotnet restore really needs such basic progress information in the CLI out of the box with the default settings.

I don't know if this is the correct project to report this problem (this existing issue seemed relevant). Please let me know if I should be opening an issue somewhere else, for example https://github.com/dotnet/sdk

Also tagging @dsyme @interesaaat

I'm using dotnet CLI tools on linux. This is the output of dotnet --info if it helps:

.NET Core SDK (reflecting any global.json):
 Version:   3.1.201
 Commit:    b1768b4ae7

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/3.1.201/

Host (useful for support):
  Version: 3.1.3
  Commit:  4a9f85e9f8

.NET Core SDKs installed:
  3.1.201 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

@zivkan zivkan changed the title dotnet restore appears to hang on slow connections Display progress bar on "interactive" (not CI) command line restore May 24, 2021
@zivkan
Copy link
Member

zivkan commented Oct 12, 2021

For Microsoft's 2021 hackathon, I started working on this, however, now that NuGet is integrated in MSBuild, I found that MSBuild itself is blocking this from being possible to implement. Specifically, after an MSBuild log message is written, I need to be able to write the progress bar to the new last line on the console. However, MSBuild's Log*() methods are non-blocking, meaking that most of the time my code writes the progress bar before MSBuild writes the message, making output quite unpleasant.

For now, I feel like this issue is blocked.

@zivkan zivkan added Partner:MSBuild Resolution:BlockedByExternal Progress on this task is blocked by an external issue. When that issue is completed this can proceed labels Oct 12, 2021
@gbaydin
Copy link

gbaydin commented Oct 13, 2021

Hi @zivkan I'm really happy to hear you considered to work on this.

It's easily the biggest problem with the user experience in dotnet package management for me. All other ecosystems have some way of indicating when the user is waiting for a package download to finish. In my case, still in 2021, I'm sometimes waiting more than 30 minutes for a dotnet restore to finish with absolutely no indication of what is going on, due to the large nature of packages I need to use for a machine learning project (multi-GB nuget packages). The command line seems blocked during this time.

I understand the difficulty you faced with new lines in the MSBuild design. Even in that case, I think nuget/msbuild can as a minimum do something like "if the package download seems to take more than 10 seconds, print a new line saying that nuget is downloading package, this might take a few minutes..." so there is at least an indication of what is going on.

I'm actually really frustrated that nuget/msbuild project managers haven't addressed something so basic this for so long.

@zivkan
Copy link
Member

zivkan commented Oct 26, 2021

FWIW, here's where we got in the hackathon.

nuget restore progress

but it uses new MSBuild APIs to avoid the issue in the linked msbuild repo. Therefore, NuGet can't ship this prototype until/unless MSBuild ship the new API.

@xoofx
Copy link

xoofx commented Nov 23, 2023

We are running dotnet restore on large projects with lots of RuntimeIdentifiers, my network connection not being always fast can make the restore take more than 10min and while I'm not seeing any progress. This is quite a frustrating experience to say the least.

@zivkan it seems you had a prototype on showing some progress. What should be done to have this upstream? Do you have this on a branch somewhere?

@baronfel
Copy link

@xoofx we on the MSBuild side are also interested in progress reporting, potentially including it into the Logger APIs the engine provides to Tasks so that loggers like Terminal Logger can report progress - this API shape is something we're hoping to work on partners with over the next few months. We'd prefer to do something in a unified way rather than each Task having to reimplement the wheel.

@xoofx
Copy link

xoofx commented Nov 23, 2023

@baronfel That's great to hear!

I can see that dotnet/msbuild#6944 is opened. Unless someone is already working on it, and if this can help, I can make a proposal API with a PR to start the discussion?

@tkreindler
Copy link

Has there been any progress on this? I work on a large monorepo within Microsoft and long NuGet restores of 15+ minutes are an everyday occurrence - and easily over an hour if you're doing some cross-cutting refactor. A progress bar would be great.

@baronfel
Copy link

We're working on this in MSBuild itself right now. The MSBuild engine will gain APIs for reporting progress, then Restore and other Tasks can use those APIs to tell the MSBuild engine what the status of their operations are.

Once we have these APIs, MSBuild loggers like the new Terminal Logger can render these progress messages using things like progress bars.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:Logging Functionality:Restore Partner:MSBuild Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Resolution:BlockedByExternal Progress on this task is blocked by an external issue. When that issue is completed this can proceed Type:Feature
Projects
None yet
Development

No branches or pull requests