-
Notifications
You must be signed in to change notification settings - Fork 6
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
JIT cache implementation #15
Conversation
This is so discovery can properly setup secrets for uploading results to a Nix cache.
Pulling a single derivation and its deps from a Nix cache is a lot faster than pulling the entire /nix/store produced by the discovery phase, so allow us to skip the GitHub cache restoration if they are available.
So after getting this to "work" and testing it out, it is going to be even more expensive during the upload phase because querying the cache for existing paths is massively inefficient en masse currently: NixOS/nix#7221 (comment) We could set a massive Plus, even after waiting a full hour in the CI runner, the task cache never even finished querying paths, so I'm not sure if I'll ever be able to poppulate the query cache in the first place. Update The default GH Linux runner has 2 cores, so some rough math would have us waiting aproximately 51 minutes just to query that the derivations already exist in the cache 🤦 |
Moving to draft unless/until we find a better solution to this. Our hopes for efficient persistent state in the case of heavy evaluations will have to rest on #14 for now. This did give me an idea for a new project though: maybe at some point in the future we could write some kind of frontend that can index a Nix cache and provide cheaper query API. In order for it to be really useful though it would also need to know how to write to the cache, so you'd probably have to teach the nix cli how to talk to this frontend if it is available, rather than manually querying each path individually. In any case, just a thought I wanted to get down in case we ever have time to work it out further. |
115242f
to
12fbb7e
Compare
For context of future readers. This has progressed via #14 into: ssh "$DISCOVERY_SSH" -- \
'nix-store --export \
$(nix-store --query --requisites \
${{ fromJSON(inputs.json).targetDrv }} \
${{ fromJSON(inputs.json).actionDrv }} \
) \
| zstd' \
| unzstd \
| nix-store --import &>/dev/null |
0ac0efd
to
e3ef02b
Compare
Partially fixes #13.
The initial implementation allows a user to optionally pull the target derivation from the configured Nix cache. It's availability can be determined by using the
cached
output from the discover action.This includes a refactoring of secrets into their own action so it can be used to setup secrets for both discovery and for the runners. All secret related inputs to the run action have been moved into this new action.
For projects that produce a large /nix/store in the discovery phase, this should drastically increase task startup time. In order to improve total action runtime further, we would need a more granular
needs
that can skip waiting on thepost
step for the discover action.We should probably request this upstream, but I am not sure where would be appropriate. actions/toolkit perhaps?