瀏覽代碼

feat: default recipe port is 30000

Previously the recipe port defaulted to 0 (TOML default for u16).
Recipes had to set port explicitly.  Most existing recipes use 30000,
so make it the default and let users override via recipe.toml.

- Added default_port() returning 30000 and wired it into serde.
- Removed now-redundant `port = 8000` from test-sleep recipe.
- Updated fixtures in before_serve.rs / config.rs tests.
Alexander Korolev 4 月之前
父節點
當前提交
1fa2811301
共有 3 個文件被更改,包括 10 次插入 和 11 次删除
  1. 0 1
      recipes/test-sleep/recipe.toml
  2. 1 1
      src/before_serve.rs
  3. 9 9
      src/config.rs

+ 0 - 1
recipes/test-sleep/recipe.toml

@@ -2,7 +2,6 @@ engine = "vllm"
 name = "Test Heartbeat Container"
 docker_image = "alpine:latest"
 model = "noop"
-port = 8000
 
 # Heartbeat loop: prints a timestamped line every 2s with UTC time and
 # the container hostname so you can tell logs from different nodes apart.

+ 1 - 1
src/before_serve.rs

@@ -227,7 +227,7 @@ mod tests {
             name: "Test".to_string(),
             docker_image: String::new(),
             model: "x".to_string(),
-            port: 0,
+            port: 30000,
             required_nodes: None,
             pipeline_parallel_size: None,
             tensor_parallel_size: 1,

+ 9 - 9
src/config.rs

@@ -47,12 +47,12 @@ pub struct Config {
     pub nccl: HashMap<String, NcclConfig>,
     #[serde(default)]
     pub hf_cache_dir: Option<String>,
-    /// TCP port for cluster init (vLLM/SGLang).
+    /// TCP port for cluster init (vLLM/SGLang)
     #[serde(default = "default_init_port")]
     pub init_port: u16,
-    /// Per-cluster pre-serve commands, command aliases, HA config.
+    /// Per-cluster pre-serve commands, command aliases, HA config
     #[serde(default)]
-    pub before_serve: HashMap<String, BeforeServeTable>,
+    pub before_serve: HashMap<String, BeforeServeTable>, // <-- move here
     #[serde(default)]
     pub exec_aliases: HashMap<String, String>,
     #[serde(default)]
@@ -75,6 +75,9 @@ fn default_shutdown_delay() -> u64 {
 fn default_init_port() -> u16 {
     25000
 }
+fn default_port() -> u16 {
+    30000
+}
 
 impl Config {
     pub fn resolved_hf_cache_dir(&self) -> String {
@@ -99,7 +102,7 @@ pub struct Recipe {
     pub docker_image: String,
     #[serde(default)]
     pub model: String,
-    #[serde(default)]
+    #[serde(default = "default_port")]
     pub port: u16,
     #[serde(default)]
     pub required_nodes: Option<u32>,
@@ -117,8 +120,7 @@ pub struct Recipe {
     pub entrypoint: Vec<String>,
     #[serde(default = "default_distributed_backend")]
     pub distributed_backend: String,
-    /// Shared memory size for the container (e.g. "10g", "64gb").
-    /// Default: "10g".  Larger contexts (1M tokens) need much more.
+    /// Shared memory size for the container. Default: "10g".
     #[serde(default = "default_shm_size")]
     pub shm_size: String,
     /// Recipe-level pre-serve commands (appended after cluster-level).
@@ -295,7 +297,7 @@ model = "test/model"
         assert_eq!(recipe.name, "Minimal");
         assert_eq!(recipe.model, "test/model");
         assert_eq!(recipe.engine, "vllm");
-        assert_eq!(recipe.port, 0);
+        assert_eq!(recipe.port, 30000);
         assert!(recipe.args.is_empty());
         assert!(recipe.env.is_empty());
         assert_eq!(recipe.distributed_backend, "mp");
@@ -397,8 +399,6 @@ nodes = [
         );
     }
 
-    // ── select_cluster tests ───────────────────────────────────
-
     #[test]
     fn test_select_cluster_by_name() {
         let mut config = Config {