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

npm package untar not to use remote-cache #1974

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

fa93hws
Copy link

@fa93hws fa93hws commented Oct 13, 2024

It's pretty meaningless to use remote-cache for npm untar action. All npm packages are small in size I think?

  • If there's a few files in the tarball, untar would be instant anyway
  • If there's a lot of files in the barball, untar would be instant, but it takes long time to upload to remote cache

image

And even if there's a big tarball, it probably take similar time to extract the tarball vs downloading these files from remote-cache? Even if the remote-cache is a local implemented one.

Copy link

aspect-workflows bot commented Oct 13, 2024

Test

All tests were cache hits

203 tests (100.0%) were fully cached saving 40s.


Test

e2e/bzlmod

All tests were cache hits

5 tests (100.0%) were fully cached saving 789ms.


Test

e2e/gyp_no_install_script

All tests were cache hits

2 tests (100.0%) were fully cached saving 184ms.


Test

e2e/js_image_oci

All tests were cache hits

1 test (100.0%) was fully cached saving 9s.


Test

e2e/npm_link_package

All tests were cache hits

3 tests (100.0%) were fully cached saving 920ms.


Test

e2e/npm_link_package-esm

All tests were cache hits

3 tests (100.0%) were fully cached saving 924ms.


Test

e2e/npm_translate_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 27ms.


Test

e2e/npm_translate_lock_empty

All tests were cache hits

1 test (100.0%) was fully cached saving 27ms.


Test

e2e/npm_translate_lock_multi

All tests were cache hits

2 tests (100.0%) were fully cached saving 296ms.


Test

e2e/npm_translate_lock_partial_clone

All tests were cache hits

1 test (100.0%) was fully cached saving 112ms.


Test

e2e/npm_translate_lock_replace_packages

All tests were cache hits

3 tests (100.0%) were fully cached saving 254ms.


Test

e2e/npm_translate_lock_subdir_patch

All tests were cache hits

1 test (100.0%) was fully cached saving 236ms.


Test

e2e/npm_translate_package_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 81ms.


Test

e2e/npm_translate_yarn_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 81ms.


Test

e2e/package_json_module

All tests were cache hits

1 test (100.0%) was fully cached saving 504ms.


Test

e2e/pnpm_lockfiles

All tests were cache hits

40 tests (100.0%) were fully cached saving 2s.


Test

e2e/pnpm_workspace

All tests were cache hits

10 tests (100.0%) were fully cached saving 2s.


Test

e2e/pnpm_workspace_rerooted

All tests were cache hits

10 tests (100.0%) were fully cached saving 2s.


Test

e2e/repo_mapping

All tests were cache hits

2 tests (100.0%) were fully cached saving 493ms.


Test

e2e/rules_foo

All tests were cache hits

2 tests (100.0%) were fully cached saving 153ms.


Test

e2e/runfiles

All tests were cache hits

1 test (100.0%) was fully cached saving 413ms.


Test

e2e/vendored_node

All tests were cache hits

1 test (100.0%) was fully cached saving 171ms.


Buildifier      Format

@CLAassistant
Copy link

CLAassistant commented Oct 13, 2024

CLA assistant check
All committers have signed the CLA.

@fa93hws fa93hws changed the title npm package untar to not use remote-cache npm package untar not to use remote-cache Oct 13, 2024
# cache in most of the cases, and untar creates mutliple outputs and sometimes the number of the output can be massive
# meaning it can takes much more time to upload the cache compared to the actual untar.
# see https://github.com/aspect-build/rules_js/pull/1974
execution_requirements = {
Copy link
Collaborator

@dzbarsky dzbarsky Oct 16, 2024

Choose a reason for hiding this comment

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

I'd believe this is a speedup for local builds, but I think it's a pessimization for remote builds, since you'd need to upload the results anyway to the remote cluster. Same exact reasoning as the execution requirements on bazel-lib CopyFile applies here. So let's make this configurable if we do land it

Choose a reason for hiding this comment

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

I remembered the original CopyFile/Directory execution requirements didn't play well with BWOB and was worried about the same thing here.

Copy link
Member

Choose a reason for hiding this comment

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

Right, the problem is:

  • if inputs are local, and subsequent actions that depend on the outputs will run local, you want this action to run local and skip writing the result to remote cache
  • if inputs are remote, or subsequent actions are remote, you want this action to run remote and store result in the remote cache

So there isn't a reasonable default we can use for everyone. Perhaps a better answer is to document that you can use --modify_execution_info= NpmPackageExtract=+no-remote if you find your builds are better tuned with that setting

Copy link
Member

Choose a reason for hiding this comment

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

another possibility is to add that flag to a preset, like https://github.com/bazel-contrib/bazel-lib/blob/main/.aspect/bazelrc/javascript.bazelrc - this way more devs will discover it

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.

5 participants