Skip to content

Commit 94924a0

Browse files
Merge branch 'main' into remote-persistent-safe
2 parents b3e4746 + 0cd70ee commit 94924a0

33 files changed

+474
-96
lines changed

.github/workflows/native-cargo.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ jobs:
4141
run: rustup update && rustup default ${{ matrix.toolchain }}
4242
shell: bash
4343

44+
- name: Install protoc
45+
run: |
46+
if [ "$RUNNER_OS" == "Linux" ]; then
47+
sudo apt-get update && sudo apt-get install -y protobuf-compiler
48+
elif [ "$RUNNER_OS" == "Windows" ]; then
49+
choco install protoc
50+
fi
51+
shell: bash
52+
4453
- name: Rust cache
4554
# https://github.com/Swatinem/rust-cache/releases/tag/v2.8.1
4655
uses: Swatinem/rust-cache@a84bfdc502f07db5a85dd9d7a30f91a931516cc5

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
then [pkgs.mold]
142142
else [pkgs.llvmPackages_20.lld]
143143
)
144+
++ [p.protobuf] # Required for nativelink-crio-worker-pool proto compilation
144145
++ pkgs.lib.optionals p.stdenv.targetPlatform.isDarwin [
145146
p.darwin.apple_sdk.frameworks.Security
146147
p.libiconv

nativelink-config/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ rust_library(
1616
"src/schedulers.rs",
1717
"src/serde_utils.rs",
1818
"src/stores.rs",
19+
"src/warm_worker_pools.rs",
1920
],
2021
compile_data = [
2122
"README.md",

nativelink-config/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ version = "0.7.6"
1010
nativelink-error = { path = "../nativelink-error" }
1111

1212
byte-unit = { version = "5.1.6", default-features = false, features = ["byte"] }
13-
humantime = { version = "2.2.0", default-features = false }
13+
humantime = { version = "2.3.0", default-features = false }
1414
rand = { version = "0.9.0", default-features = false, features = [
1515
"thread_rng",
1616
] }

nativelink-config/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,4 @@ pub mod cas_server;
1717
pub mod schedulers;
1818
pub mod serde_utils;
1919
pub mod stores;
20-
21-
// Warm worker pools configuration (optional feature)
22-
#[cfg(feature = "warm-worker-pools")]
2320
pub mod warm_worker_pools;

nativelink-config/src/schedulers.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use crate::serde_utils::{
2121
convert_numeric_with_shellexpand,
2222
};
2323
use crate::stores::{GrpcEndpoint, Retry, StoreRefName};
24-
2524
// Import warm worker pool configuration
2625
#[cfg(feature = "warm-worker-pools")]
2726
use crate::warm_worker_pools::WarmWorkerPoolsConfig;

nativelink-config/src/stores.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ pub struct OntapS3ExistenceCacheSpec {
639639
pub backend: Box<ExperimentalOntapS3Spec>,
640640
}
641641

642-
#[derive(Serialize, Deserialize, Default, Debug, Clone, Copy, PartialEq)]
642+
#[derive(Serialize, Deserialize, Default, Debug, Clone, Copy, PartialEq, Eq)]
643643
#[serde(rename_all = "snake_case")]
644644
pub enum StoreDirection {
645645
/// The store operates normally and all get and put operations are

nativelink-config/src/warm_worker_pools.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl Default for LifecycleConfig {
132132
}
133133

134134
/// Isolation strategy for worker jobs.
135-
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
135+
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq)]
136136
#[serde(rename_all = "snake_case")]
137137
pub enum IsolationStrategy {
138138
/// No isolation - workers execute multiple jobs with shared state (default, backward compatible).

nativelink-crio-worker-pool/BUILD.bazel

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,98 @@
1+
load("@bazel_skylib//lib:selects.bzl", "selects")
12
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")
23

4+
# Platform configurations for protoc
5+
PLATFORM_OS_ARCH = [
6+
("linux", "aarch64"),
7+
("linux", "x86_64"),
8+
("macos", "aarch64"),
9+
("macos", "x86_64"),
10+
("windows", "aarch64"),
11+
("windows", "x86_64"),
12+
]
13+
14+
[
15+
selects.config_setting_group(
16+
name = "{}_{}".format(
17+
os.replace("macos", "osx"),
18+
arch.replace("aarch64", "aarch_64"),
19+
),
20+
match_all = [
21+
"@platforms//cpu:{}".format(arch),
22+
"@platforms//os:{}".format(os),
23+
],
24+
)
25+
for (os, arch) in PLATFORM_OS_ARCH
26+
]
27+
28+
PLATFORM_NAMES = [
29+
"{}_{}".format(
30+
os.replace("macos", "osx"),
31+
arch.replace("aarch64", "aarch_64"),
32+
)
33+
for (os, arch) in PLATFORM_OS_ARCH
34+
]
35+
36+
# Generate Rust code from CRI proto files
37+
genrule(
38+
name = "gen_cri_protos",
39+
srcs = ["proto/cri/api.proto"],
40+
outs = ["runtime.v1.pb.rs"],
41+
cmd = select({
42+
platform: '''
43+
set -e
44+
export PROTOC=$(execpath @@toolchains_protoc++protoc+toolchains_protoc_hub.{}//:bin/protoc)
45+
46+
$(execpath //nativelink-proto:gen_protos_tool) $(SRCS) -o $(RULEDIR)
47+
48+
for file in $(RULEDIR)/*.rs; do
49+
mv -- "$$file" "$${{file%.rs}}.pb.rs"
50+
done
51+
'''.format(platform)
52+
for platform in PLATFORM_NAMES
53+
}),
54+
tools = [
55+
"//nativelink-proto:gen_protos_tool",
56+
] + select({
57+
platform: ["@@toolchains_protoc++protoc+toolchains_protoc_hub.{}//:bin/protoc".format(platform)]
58+
for platform in PLATFORM_NAMES
59+
}),
60+
)
61+
362
rust_library(
463
name = "nativelink-crio-worker-pool",
564
srcs = [
665
"src/cache.rs",
766
"src/config.rs",
867
"src/cri_client.rs",
68+
"src/cri_client_grpc.rs",
69+
"src/isolation.rs",
970
"src/lib.rs",
1071
"src/lifecycle.rs",
1172
"src/pool_manager.rs",
1273
"src/warmup.rs",
1374
"src/worker.rs",
75+
":gen_cri_protos",
76+
],
77+
compile_data = [
78+
":gen_cri_protos",
1479
],
80+
tags = ["no-clippy"],
1581
visibility = ["//visibility:public"],
1682
deps = [
83+
"//nativelink-config",
1784
"//nativelink-error",
85+
"//nativelink-metric",
1886
"//nativelink-util",
87+
"@crates//:hyper-util",
88+
"@crates//:prost",
1989
"@crates//:serde",
2090
"@crates//:serde_json",
2191
"@crates//:serde_with",
2292
"@crates//:tempfile",
2393
"@crates//:tokio",
94+
"@crates//:tonic",
95+
"@crates//:tower",
2496
"@crates//:tracing",
2597
"@crates//:uuid",
2698
],
@@ -29,4 +101,5 @@ rust_library(
29101
rust_test(
30102
name = "unit_tests",
31103
crate = ":nativelink-crio-worker-pool",
104+
tags = ["no-clippy"],
32105
)

0 commit comments

Comments
 (0)