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

Client snapshot download progress with json output #1172

Merged

Conversation

Alenar
Copy link
Collaborator

@Alenar Alenar commented Aug 23, 2023

Content

This PR enhance mithril-client command snapshot download json output (--json parameter).
Instead of reporting nothing until the command finish using --json will now print:

  • The current step of the process, ie:
{"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…"}
  • The current progress when in downloading (approximately every 333ms), ie:
{ "bytesDownloaded": 2067507114, "bytesTotal": 2438424190, "secondsLeft": 10.408, "secondsElapsed": 58.296 }
{ "bytesDownloaded": 2079647658, "bytesTotal": 2438424190, "secondsLeft": 10.65, "secondsElapsed": 58.629 }
{ "bytesDownloaded": 2091788202, "bytesTotal": 2438424190, "secondsLeft": 9.723, "secondsElapsed": 58.962 }
{ "bytesDownloaded": 2103928746, "bytesTotal": 2438424190, "secondsLeft": 9.380, "secondsElapsed": 59.296 }
{ "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 }

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Crates versions are updated (if relevant)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
  • PR
    • No clippy warnings in the CI
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested
  • Documentation
    • Update README file (if relevant)
    • Update documentation website (if relevant)
    • Add dev blog post (if relevant)

Issue(s)

Relates to #1095

This is done using a new type, `DownloadProgressReporter`, that wrap a
indicatif progress bar that give to use all the data that we need to
print, thank you indicatif !
Those print are limited to one every 333ms.
@Alenar Alenar requested a review from dlachaume August 23, 2023 16:04
@Alenar Alenar force-pushed the ensemble/1095/client-snapshot-download-progress-with-json-output branch from 36afdbd to e9dc557 Compare August 23, 2023 16:08
Copy link
Collaborator

@dlachaume dlachaume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@github-actions
Copy link

Test Results

    3 files  ±0    17 suites  ±0   6m 13s ⏱️ +3s
671 tests ±0  671 ✔️ ±0  0 💤 ±0  0 ±0 
727 runs  ±0  727 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit e9dc557. ± Comparison against base commit bfe3867.

@Alenar Alenar temporarily deployed to testing-preview August 23, 2023 16:17 — with GitHub Actions Inactive
@Alenar Alenar merged commit 12f65cf into main Aug 24, 2023
25 of 26 checks passed
@Alenar Alenar deleted the ensemble/1095/client-snapshot-download-progress-with-json-output branch August 24, 2023 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants