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

Provide progress information with --json option in Client #1095

Closed
jpraynaud opened this issue Jul 26, 2023 · 4 comments
Closed

Provide progress information with --json option in Client #1095

jpraynaud opened this issue Jul 26, 2023 · 4 comments
Labels
devX 🌞 Developer experience idea 💡 Something to discuss and refine optimization 🛠️ Optimization and/or small enhancements

Comments

@jpraynaud
Copy link
Member

jpraynaud commented Jul 26, 2023

Issue

In order to facilitate integration of the Mithril Client with third party software (e.g. Lace backend), we need to provide machine readable progress information when the --json flag is used in the snapshot download command.

Question: do we want to make --json a global option?

@jpraynaud jpraynaud added idea 💡 Something to discuss and refine dev 💪 optimization 🛠️ Optimization and/or small enhancements to-groom 🤔 Needs grooming devX 🌞 Developer experience labels Jul 26, 2023
@michalrus
Copy link
Member

michalrus commented Aug 3, 2023

Can we get a new JSON on stdout every 333 ms or so? This frequency feels good in a graphical UI, IMO

With:

  • bytesDownloaded
  • bytesTotal
  • maybe secondsLeft – this estimation is available now in TTY

Right now we integrate Lace with Mithril, by running mithril-client in a Pseudo TTY

@michalrus
Copy link
Member

@Alenar
Copy link
Collaborator

Alenar commented Aug 24, 2023

@michalrus We just merged #1172 that update the json output of the snapshot download command:
It will now out the current step of the process and, when downloading, a message every ~333ms or so with the current progress of the download:

{"step_num": 1, "total_steps": 7, "message": "Checking local disk info…"}                                                                                                    
{"step_num": 2, "total_steps": 7, "message": "Fetching the certificate's information…"}                                                                                      
{"step_num": 3, "total_steps": 7, "message": "Verifying the certificate chain…"}                                                                                             
{"step_num": 4, "total_steps": 7, "message": "Downloading the snapshot…"}
{ "bytesDownloaded": 376, "bytesTotal": 2438424190, "secondsLeft": 1971633.967, "secondsElapsed": 0.304 }                                                                                                                                     
{ "bytesDownloaded": 11204689, "bytesTotal": 2438424190, "secondsLeft": 442.483, "secondsElapsed": 0.637 }                                                                                                                                    
{ "bytesDownloaded": 23345233, "bytesTotal": 2438424190, "secondsLeft": 212.285, "secondsElapsed": 0.970 }                                                                                                                                    
{ "bytesDownloaded": 35485777, "bytesTotal": 2438424190, "secondsLeft": 154.834, "secondsElapsed": 1.303 }

-- truncated ...

{ "bytesDownloaded": 2116069290, "bytesTotal": 2438424190, "secondsLeft": 9.37, "secondsElapsed": 59.629 }
{ "bytesDownloaded": 2128209834, "bytesTotal": 2438424190, "secondsLeft": 8.694, "secondsElapsed": 59.962 }
{ "bytesDownloaded": 2138122154, "bytesTotal": 2438424190, "secondsLeft": 8.414, "secondsElapsed": 60.295 }
{ "bytesDownloaded": 2147870634, "bytesTotal": 2438424190, "secondsLeft": 8.146, "secondsElapsed": 60.629 }

-- truncated ...

{"step_num": 5, "total_steps": 7, "message": "Unpacking the snapshot…"}

This behavior is available currently on the unstable release: https://github.com/input-output-hk/mithril/releases/tag/unstable

Does this answer your needs for the download command ?

@michalrus
Copy link
Member

It looks like exactly what we needed based on your message! I haven't tried to integrate it yet, will try to do so soon 😃

Thank you so much!

@jpraynaud jpraynaud removed the to-groom 🤔 Needs grooming label Aug 28, 2023
@Alenar Alenar closed this as completed Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devX 🌞 Developer experience idea 💡 Something to discuss and refine optimization 🛠️ Optimization and/or small enhancements
Projects
None yet
Development

No branches or pull requests

3 participants