Skip to content

Commit

Permalink
Make stores and schedulers lists of named specs
Browse files Browse the repository at this point in the history
To migrate, change your config like this (similar for schedulers):

```
// Old:
"stores": {
  "SOMESTORE": {
    "memory": {}
  }
}

// New:
"stores": [
  {
    "name": "SOMESTORE",
    "memory": {}
  }
]
```

For now this is not a breaking change, but a backwards compatible one.
The backwards-compatibility code will be removed after the next release
in a breaking change.

Closes TraceMachina#834
  • Loading branch information
aaronmondal committed Nov 25, 2024
1 parent afe0f4c commit d80dd7b
Show file tree
Hide file tree
Showing 18 changed files with 312 additions and 94 deletions.
5 changes: 3 additions & 2 deletions Cargo.lock

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

11 changes: 6 additions & 5 deletions deployment-examples/docker-compose/local-storage-cas.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
// so objects are compressed, deduplicated and uses some in-memory
// optimizations for certain hot paths.
{
"stores": {
"CAS_MAIN_STORE": {
"stores": [
{
"name": "CAS_MAIN_STORE",
"compression": {
"compression_algorithm": {
"lz4": {}
Expand All @@ -21,8 +22,8 @@
}
}
}
},
"AC_MAIN_STORE": {
}, {
"name": "AC_MAIN_STORE",
"filesystem": {
"content_path": "~/.cache/nativelink/content_path-ac",
"temp_path": "~/.cache/nativelink/tmp_path-ac",
Expand All @@ -32,7 +33,7 @@
}
}
}
},
],
"servers": [{
"listener": {
"http": {
Expand Down
18 changes: 10 additions & 8 deletions deployment-examples/docker-compose/scheduler.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"stores": {
"GRPC_LOCAL_STORE": {
"stores": [
{
"name": "GRPC_LOCAL_STORE",
// Note: This file is used to test GRPC store.
"grpc": {
"instance_name": "main",
Expand All @@ -9,8 +10,8 @@
],
"store_type": "cas"
}
},
"GRPC_LOCAL_AC_STORE": {
}, {
"name": "GRPC_LOCAL_AC_STORE",
// Note: This file is used to test GRPC store.
"grpc": {
"instance_name": "main",
Expand All @@ -20,9 +21,10 @@
"store_type": "ac"
}
}
},
"schedulers": {
"MAIN_SCHEDULER": {
],
"schedulers": [
{
"name": "MAIN_SCHEDULER",
"simple": {
"supported_platform_properties": {
"cpu_count": "minimum",
Expand All @@ -31,7 +33,7 @@
}
}
}
},
],
"servers": [{
"listener": {
"http": {
Expand Down
15 changes: 8 additions & 7 deletions deployment-examples/docker-compose/worker.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"stores": {
"GRPC_LOCAL_STORE": {
"stores": [
{
"name": "GRPC_LOCAL_STORE",
// Note: This file is used to test GRPC store.
"grpc": {
"instance_name": "main",
Expand All @@ -9,8 +10,8 @@
],
"store_type": "cas"
}
},
"GRPC_LOCAL_AC_STORE": {
}, {
"name": "GRPC_LOCAL_AC_STORE",
// Note: This file is used to test GRPC store.
"grpc": {
"instance_name": "main",
Expand All @@ -19,8 +20,8 @@
],
"store_type": "ac"
}
},
"WORKER_FAST_SLOW_STORE": {
}, {
"name": "WORKER_FAST_SLOW_STORE",
"fast_slow": {
"fast": {
"filesystem": {
Expand All @@ -39,7 +40,7 @@
}
}
}
},
],
"workers": [{
"local": {
"worker_api_endpoint": {
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@
pkgs.cosign
pkgs.kubectl
pkgs.kubernetes-helm
pkgs.kubectx
pkgs.cilium-cli
pkgs.vale
pkgs.trivy
Expand Down
11 changes: 6 additions & 5 deletions kubernetes/configmaps/cas.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// `~/.cache/nativelink`. When this location is mounted as a PersistentVolume
// it persists the cache across restarts.
{
"stores": {
"CAS_MAIN_STORE": {
"stores": [
{
"name": "CAS_MAIN_STORE",
"existence_cache": {
"backend": {
"compression": {
Expand All @@ -23,8 +24,8 @@
}
}
}
},
"AC_MAIN_STORE": {
}, {
"name": "AC_MAIN_STORE",
"completeness_checking": {
"backend": {
"filesystem": {
Expand All @@ -43,7 +44,7 @@
}
}
}
},
],
"servers": [{
"listener": {
"http": {
Expand Down
18 changes: 10 additions & 8 deletions kubernetes/configmaps/scheduler.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"stores": {
"GRPC_LOCAL_STORE": {
"stores": [
{
"name": "GRPC_LOCAL_STORE",
// Note: This file is used to test GRPC store.
"grpc": {
"instance_name": "main",
Expand All @@ -9,8 +10,8 @@
],
"store_type": "cas"
}
},
"GRPC_LOCAL_AC_STORE": {
}, {
"name": "GRPC_LOCAL_AC_STORE",
// Note: This file is used to test GRPC store.
"grpc": {
"instance_name": "main",
Expand All @@ -20,9 +21,10 @@
"store_type": "ac"
}
}
},
"schedulers": {
"MAIN_SCHEDULER": {
],
"schedulers": [
{
"name": "MAIN_SCHEDULER",
// TODO(adams): use the right scheduler because reclient doesn't use the cached results?
// TODO(adams): max_bytes_per_stream
"simple": {
Expand All @@ -46,7 +48,7 @@
}
}
}
},
],
"servers": [{
"listener": {
"http": {
Expand Down
15 changes: 8 additions & 7 deletions kubernetes/configmaps/worker.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"stores": {
"GRPC_LOCAL_STORE": {
"stores": [
{
"name": "GRPC_LOCAL_STORE",
// Note: This file is used to test GRPC store.
"grpc": {
"instance_name": "main",
Expand All @@ -9,8 +10,8 @@
],
"store_type": "cas"
}
},
"GRPC_LOCAL_AC_STORE": {
}, {
"name": "GRPC_LOCAL_AC_STORE",
// Note: This file is used to test GRPC store.
"grpc": {
"instance_name": "main",
Expand All @@ -19,8 +20,8 @@
],
"store_type": "ac"
}
},
"WORKER_FAST_SLOW_STORE": {
}, {
"name": "WORKER_FAST_SLOW_STORE",
"fast_slow": {
"fast": {
"filesystem": {
Expand All @@ -39,7 +40,7 @@
}
}
}
},
],
"workers": [{
"local": {
"worker_api_endpoint": {
Expand Down
2 changes: 2 additions & 0 deletions nativelink-config/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ rust_test_suite(
name = "integration",
timeout = "short",
srcs = [
"tests/backwards_compat_test.rs",
"tests/deserialization_test.rs",
],
deps = [
Expand All @@ -40,6 +41,7 @@ rust_test_suite(
"@crates//:humantime",
"@crates//:pretty_assertions",
"@crates//:serde",
"@crates//:serde_json",
"@crates//:serde_json5",
],
)
Expand Down
1 change: 1 addition & 0 deletions nativelink-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ shellexpand = { version = "3.1.0", default-features = false, features = ["base-0

[dev-dependencies]
pretty_assertions = { version = "1.4.1", features = ["std"] }
serde_json = "1.0.133"
18 changes: 10 additions & 8 deletions nativelink-config/examples/basic_cas.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"stores": {
"AC_MAIN_STORE": {
"stores": [
{
"name": "AC_MAIN_STORE",
"filesystem": {
"content_path": "/tmp/nativelink/data-worker-test/content_path-ac",
"temp_path": "/tmp/nativelink/data-worker-test/tmp_path-ac",
Expand All @@ -9,8 +10,8 @@
"max_bytes": 1000000000,
}
}
},
"WORKER_FAST_SLOW_STORE": {
}, {
"name": "WORKER_FAST_SLOW_STORE",
"fast_slow": {
// "fast" must be a "filesystem" store because the worker uses it to make
// hardlinks on disk to a directory where the jobs are running.
Expand All @@ -34,9 +35,10 @@
}
}
}
},
"schedulers": {
"MAIN_SCHEDULER": {
],
"schedulers": [
{
"name": "MAIN_SCHEDULER",
"simple": {
"supported_platform_properties": {
"cpu_count": "minimum",
Expand All @@ -61,7 +63,7 @@
}
}
}
},
],
"workers": [{
"local": {
"worker_api_endpoint": {
Expand Down
22 changes: 12 additions & 10 deletions nativelink-config/examples/filesystem_cas.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
// so objects are compressed, deduplicated and uses some in-memory
// optimizations for certain hot paths.
{
"stores": {
"FS_CONTENT_STORE": {
"stores": [
{
"name": "FS_CONTENT_STORE",
"compression": {
"compression_algorithm": {
"lz4": {}
Expand All @@ -21,8 +22,8 @@
}
}
}
},
"CAS_MAIN_STORE": {
}, {
"name": "CAS_MAIN_STORE",
"verify": {
"backend": {
// Because we are using a dedup store, we can bypass small objects
Expand Down Expand Up @@ -78,8 +79,8 @@
"verify_size": true,
"verify_hash": true
}
},
"AC_MAIN_STORE": {
}, {
"name": "AC_MAIN_STORE",
"filesystem": {
"content_path": "/tmp/nativelink/data/content_path-ac",
"temp_path": "/tmp/nativelink/data/tmp_path-ac",
Expand All @@ -89,9 +90,10 @@
}
}
}
},
"schedulers": {
"MAIN_SCHEDULER": {
],
"schedulers": [
{
"name": "MAIN_SCHEDULER",
"simple": {
"supported_platform_properties": {
"cpu_count": "minimum",
Expand All @@ -112,7 +114,7 @@
}
}
}
},
],
"servers": [{
"listener": {
"http": {
Expand Down
Loading

0 comments on commit d80dd7b

Please sign in to comment.