Skip to content

Commit

Permalink
🐑 Significantly reduce cluster startup time
Browse files Browse the repository at this point in the history
This change implements NativeLink's new worker-init system. This lets us
skip building nativelink from source, reducing the startup time for the
LRE workflow from ~10-15 minutes to ~1 minute.

Fixes #9
  • Loading branch information
aaronmondal committed Jun 26, 2024
1 parent f755350 commit 3fedbd6
Show file tree
Hide file tree
Showing 11 changed files with 408 additions and 2,367 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.0.0-pre.20240422.4
8.0.0-pre.20240607.2
21 changes: 11 additions & 10 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@ module(
compatibility_level = 0,
)

bazel_dep(name = "bazel_skylib", version = "1.6.1", dev_dependency = True)
bazel_dep(name = "bazel_skylib", version = "1.7.1", dev_dependency = True)

git_override(
module_name = "rules_ll",
# Note: Keep this commit in sync with the one in flake.nix.
commit = "5ac0546db310da08d44f14271066e0b159611c25",
commit = "a8a26cc78c43896b179caaa263857bd6c88a1da9",
remote = "https://github.com/eomii/rules_ll",
)

rules_ll_dependencies = use_extension(
"@rules_ll//ll:init.bzl",
"rules_ll_dependencies",
)
use_repo(
rules_ll_dependencies,
"local-remote-execution",
bazel_dep(name = "local-remote-execution", version = "0")
archive_override(
module_name = "local-remote-execution",
integrity = "sha256-uAN8j0huQ6T7O9goYWo7BO/A7uo+YqHKguca3AzD36U=",
strip_prefix = "nativelink-9ba43236cf61737cd9561a1657ee50686b459966/local-remote-execution",
urls = [
"https://github.com/TraceMachina/nativelink/archive/9ba43236cf61737cd9561a1657ee50686b459966.zip",
],
)

# Note: The pipe-through mechanism from rules_ll makes this actually LLVM~19.
Expand Down Expand Up @@ -51,4 +52,4 @@ use_repo(
)

# Documentation.
bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.7.0", dev_dependency = True)
2,467 changes: 189 additions & 2,278 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,7 @@ setup.

The setup may take a minute to boot up. When running the command the first time
it might take some time to build NativeLink from source inside the cluster
pipelines. Once the command finishes you can invoke the following command to run
a local dashboard:

```bash
kubectl -n kube-system port-forward svc/hubble-ui 8080:80
```
pipelines.

Visit <http://localhost:8080/?namespace=default> to view the cluster topology.

Expand Down
64 changes: 32 additions & 32 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
};
nativelink = {
# Note: Keep this commit in sync with the LRE commit in `MODULE.bazel`.
url = "github:TraceMachina/nativelink/v0.4.0";
url = "github:TraceMachina/nativelink/9ba43236cf61737cd9561a1657ee50686b459966";

# This repository provides the autogenerated LRE toolchains which are
# dependent on the nixpkgs version in the nativelink repository. To keep
Expand All @@ -37,16 +37,16 @@
inputs = {
flake-utils.follows = "flake-utils";
flake-parts.follows = "flake-parts";
pre-commit-hooks.follows = "pre-commit-hooks";
git-hooks.follows = "pre-commit-hooks";
};
};
rules_ll = {
url = "github:eomii/rules_ll/5ac0546db310da08d44f14271066e0b159611c25";
url = "github:eomii/rules_ll/a8a26cc78c43896b179caaa263857bd6c88a1da9";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
flake-parts.follows = "flake-parts";
pre-commit-hooks.follows = "pre-commit-hooks";
git-hooks.follows = "pre-commit-hooks";
nativelink.follows = "nativelink";
};
};
Expand Down
7 changes: 2 additions & 5 deletions local-remote-execution/create-worker.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
# pkgs,
nativelink
, buildImage
{ buildImage
, self
, runCommand
, runtimeShell
Expand Down Expand Up @@ -89,7 +86,7 @@ buildImage {
mkEnvSymlink
(buildEnv {
name = "${image.imageName}-buildEnv";
paths = [ nativelink coreutils bash ];
paths = [ coreutils bash ];
pathsToLink = [ "/bin" ];
})
];
Expand Down
3 changes: 3 additions & 0 deletions local-remote-execution/lre-kill-the-mojo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ writeShellScriptBin "lre-kill-the-mojo" ''
${docker}/bin/docker container stop kind-registry \
| ${findutils}/bin/xargs docker rm
${docker}/bin/docker container stop kind-loadbalancer \
| ${findutils}/bin/xargs docker rm
''
Loading

0 comments on commit 3fedbd6

Please sign in to comment.