From e53ed3411c5e70ded20828bc2595d93e47dc41ea Mon Sep 17 00:00:00 2001 From: Chlins Zhang Date: Mon, 21 Jul 2025 13:31:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20support=20specify=20the=20schedulerClus?= =?UTF-8?q?terID=20in=20host=20config=20and=20carry=E2=80=A6=20(#1240)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat: support specify the schedulerClusterID in host config and carry it when listing schedulers Signed-off-by: chlins --- .github/workflows/ci.yml | 4 ++++ .github/workflows/lint.yml | 4 +++- Cargo.lock | 4 ++-- Cargo.toml | 2 +- dragonfly-client-config/src/dfdaemon.rs | 10 ++++++++-- dragonfly-client/src/dynconfig/mod.rs | 1 + 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c5827aa..d5e75509 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,8 @@ jobs: - name: Install Protoc uses: arduino/setup-protoc@v2 + with: + repo-token: ${{ secrets.GH_TOKEN }} - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable @@ -55,6 +57,8 @@ jobs: - name: Install Protoc uses: arduino/setup-protoc@v2 + with: + repo-token: ${{ secrets.GH_TOKEN }} - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ed15af05..7989403a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,13 +15,15 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Rust cache + - name: Rust cache uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - name: Install Protoc uses: arduino/setup-protoc@v2 + with: + repo-token: ${{ secrets.GH_TOKEN }} - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable diff --git a/Cargo.lock b/Cargo.lock index a56c6777..ba98e0a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -939,9 +939,9 @@ dependencies = [ [[package]] name = "dragonfly-api" -version = "2.1.43" +version = "2.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9776abc6461282d9c62e3b10fb499ad35b79163070672ca6d277b51819bb5712" +checksum = "76ef86d60ca52c206d9e4a7ae057d1451dacfc69d49421a6d28d6ae6723c4d79" dependencies = [ "prost 0.13.5", "prost-types 0.14.1", diff --git a/Cargo.toml b/Cargo.toml index 6b28b9b3..83247c16 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ dragonfly-client-storage = { path = "dragonfly-client-storage", version = "1.0.3 dragonfly-client-backend = { path = "dragonfly-client-backend", version = "1.0.3" } dragonfly-client-util = { path = "dragonfly-client-util", version = "1.0.3" } dragonfly-client-init = { path = "dragonfly-client-init", version = "1.0.3" } -dragonfly-api = "=2.1.43" +dragonfly-api = "=2.1.44" thiserror = "2.0" futures = "0.3.31" reqwest = { version = "0.12.4", features = [ diff --git a/dragonfly-client-config/src/dfdaemon.rs b/dragonfly-client-config/src/dfdaemon.rs index a233cf5f..9929d60a 100644 --- a/dragonfly-client-config/src/dfdaemon.rs +++ b/dragonfly-client-config/src/dfdaemon.rs @@ -413,6 +413,11 @@ pub struct Host { /// ip is the advertise ip of the host. pub ip: Option, + + /// scheduler_cluster_id is the ID of the cluster to which the scheduler belongs. + /// NOTE: This field is used to identify the cluster to which the scheduler belongs. + /// If this flag is set, the idc, location, hostname and ip will be ignored when listing schedulers. + pub scheduler_cluster_id: Option, } /// Host implements Default. @@ -423,6 +428,7 @@ impl Default for Host { location: None, hostname: default_host_hostname(), ip: None, + scheduler_cluster_id: None, } } } @@ -1035,9 +1041,9 @@ pub struct Storage { /// | | -- Partial -->| Cache | | /// | | | +-----------+ | /// | v | | | | - /// | Download | Miss | | + /// | Download | Miss | | /// | Task -->| | --- Hit ------>|<-- 2.Download - /// | | | ^ | + /// | | | ^ | /// | | v | | /// | | +-----------+ | | /// | -- Full -->| Disk |---------- | diff --git a/dragonfly-client/src/dynconfig/mod.rs b/dragonfly-client/src/dynconfig/mod.rs index db8e1941..b482849f 100644 --- a/dragonfly-client/src/dynconfig/mod.rs +++ b/dragonfly-client/src/dynconfig/mod.rs @@ -162,6 +162,7 @@ impl Dynconfig { location: self.config.host.location.clone(), version: CARGO_PKG_VERSION.to_string(), commit: GIT_COMMIT_SHORT_HASH.to_string(), + scheduler_cluster_id: self.config.host.scheduler_cluster_id.unwrap_or(0), }) .await }