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

Improve cache in github actions #2945

Closed
wants to merge 1 commit into from
Closed

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Jul 20, 2022

Which issue does this PR close?

re #2947

Rationale for this change

I have seen several PR checks failing recently related to "out of disk space", for example: https://github.com/apache/arrow-datafusion/runs/7430371132?check_suite_focus=true

You can see from that PR that the cargo cache doesn't seem to be very effective (it downloads many crates). It also seems to recompile all the dependencies, despite restoring a cache.

I believe the cache that is being used is not useful (just restoring a bunch of old files that have been outdated for a long time)

What changes are included in this PR?

  1. Change the cache key for target to include the git sha (as the point is to restore files from the linux-build-lib job earlier)
  2. TODO change the cargo cache key likewise so the build job caches the data

Are there any user-facing changes?

No

- name: Cache Rust dependencies
uses: actions/cache@v3
with:
# these represent compiled steps of both dependencies and arrow
# and thus are specific for a particular OS, arch and rust version.
path: /github/home/target
key: ${{ runner.os }}-${{ matrix.arch }}-target-cache-${{ matrix.rust }}-
key: ${{ runner.os }}-${{ matrix.arch }}-${{ matrix.rust }}-target-${{ github.sha }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the core change -- put the sha in to the cache

@@ -473,13 +473,7 @@ jobs:
with:
path: /github/home/.cargo
# this key equals the ones on `linux-build-lib` for re-use
key: cargo-cache-
- name: Cache Rust dependencies
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As this job runs cargo fmt there is no reason to restore the contents of target as part of the job

@alamb
Copy link
Contributor Author

alamb commented Jul 20, 2022

@alamb
Copy link
Contributor Author

alamb commented Jul 20, 2022

Took a different approach instead: #2948

@alamb alamb closed this Jul 20, 2022
@alamb alamb deleted the alamb/clear_caches branch July 20, 2022 19:37
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.

1 participant