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 the progressbar while downloading spec tests #7242

Draft
wants to merge 2 commits into
base: unstable
Choose a base branch
from

Conversation

mihirrchauhan
Copy link

Motivation

Currently while downloading the download-spec-tests, we don't see the progress of downloads.

Description

Used progress-stream to show the progress bar while downloading the download-spec-test.
Screenshot from 2024-11-26 10-58-22

Closes #6991

Steps to test or reproduce

yarn download-spec-tests

@CLAassistant
Copy link

CLAassistant commented Nov 26, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

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

It would be ideal if we just show one progress bar per download which overrides / updates itself and add a label to know which progress bar belongs to which download.

@@ -89,5 +89,8 @@
"loupe": "^2.3.6",
"vite": "^5.3.4",
"testcontainers/**/nan": "^2.19.0"
},
"dependencies": {
"progress-stream": "^2.0.0"
Copy link
Member

Choose a reason for hiding this comment

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

why is this added here? progress-stream should only be a dependency of spec-test-util package

@@ -132,6 +132,7 @@
"@lodestar/utils": "^1.22.0",
"@lodestar/validator": "^1.22.0",
"@multiformats/multiaddr": "^12.1.3",
"axios": "^1.7.7",
Copy link
Member

Choose a reason for hiding this comment

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

why are these dependencies added here?

log(`Downloaded ${url}`);
// Use pipeline to handle the stream and extract the tar
await promisify(stream.pipeline)(data.pipe(progress), extractTar({ cwd: outputDir }));
console.log(); // Move to the next line after the download is complete
Copy link
Member

Choose a reason for hiding this comment

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

empty console log?

@@ -0,0 +1,13 @@
declare module 'progress-stream' {
Copy link
Member

Choose a reason for hiding this comment

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

why do we need this custom type definition here?

In case this is rea/lly required it should be in https://github.com/ChainSafe/lodestar/tree/unstable/types folder

@@ -2,6 +2,8 @@
"extends": "./tsconfig.build.json",
"compilerOptions": {
"emitDeclarationOnly": false,
"esModuleInterop": true,
Copy link
Member

Choose a reason for hiding this comment

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

modifying tsconfig should not be required

@ensi321
Copy link
Contributor

ensi321 commented Nov 26, 2024

Thanks for the PR!

Echoing what @nflaig said, there shouldn't be one new progress bar printed out every time there is a progress update.

Ideally, we should have 3 progress bar for downloading general, mainnet and minimal. New progress should refer back to the progress bar it belongs to.

I think using progress-stream and manually creating the bar like

'#'.repeat(filledLength) + '-'.repeat(barLength - filledLength);

is too limiting nor clean.

I would looking into MultiBar from cli-progress (see example) for better solution.

Alternatively if 3 bars are too much to manage, we can do a single bar that shows combined download progress of the 3 files. Like first calculate the combined total size of the 3 files, make a variable downloadedSize that increments on any progress. An unideal, compromising solution for sure but better than nothing at all.

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.

Improve experience of download-spec-tests
4 participants