Parcourir la source

fix: don't pass --distributed-executor-backend mp (auto-detected)

Matches sparkrun's --no-ray mode (verified in reference project
spark-vllm-docker/run-recipe.py lines 480-486): when --no-ray is
active, the recipe runner strips --distributed-executor-backend from
the command via regex.  vLLM auto-detects mp when --nnodes > 1.

The flag is still passed explicitly for the ray backend where
auto-detection doesn't apply.
Alexander Korolev il y a 4 mois
Parent
commit
9241bdc682
2 fichiers modifiés avec 28 ajouts et 19 suppressions
  1. 23 18
      src/docker/mod.rs
  2. 5 1
      src/docker/tests.rs

+ 23 - 18
src/docker/mod.rs

@@ -456,22 +456,28 @@ fn build_docker_command(
             "--dist-init-addr".into(),
             format!("{}:{}", cluster.master_ib_ip, init_port),
         ],
-        "ray" | "mp" => vec![
-            "--tensor-parallel-size".into(),
-            recipe.tensor_parallel_size.to_string(),
-            "--pipeline-parallel-size".into(),
-            pp_size.to_string(),
-            "--nnodes".into(),
-            nnodes.to_string(),
-            "--node-rank".into(),
-            node.rank.to_string(),
-            "--master-addr".into(),
-            cluster.master_ib_ip.clone(),
-            "--master-port".into(),
-            init_port.to_string(),
-            "--distributed-executor-backend".into(),
-            recipe.distributed_backend.clone(),
-        ],
+        "ray" | "mp" => {
+            let mut fp = vec![
+                "--tensor-parallel-size".into(),
+                recipe.tensor_parallel_size.to_string(),
+                "--pipeline-parallel-size".into(),
+                pp_size.to_string(),
+                "--nnodes".into(),
+                nnodes.to_string(),
+                "--node-rank".into(),
+                node.rank.to_string(),
+                "--master-addr".into(),
+                cluster.master_ib_ip.clone(),
+                "--master-port".into(),
+                init_port.to_string(),
+            ];
+            // vLLM auto-detects mp; pass explicitly for ray only.
+            if recipe.distributed_backend == "ray" {
+                fp.push("--distributed-executor-backend".into());
+                fp.push(recipe.distributed_backend.clone());
+            }
+            fp
+        }
         _ => vec![],
     };
 
@@ -481,8 +487,7 @@ fn build_docker_command(
     }
     cmd.extend(flags);
 
-    // Host + port flags — auto-generated for both engines so recipes
-    // don't need to hardcode them.
+    // Host + port flags — auto-generated for both engines.
     cmd.push("--host".to_string());
     cmd.push("0.0.0.0".to_string());
     cmd.push("--port".to_string());

+ 5 - 1
src/docker/tests.rs

@@ -108,7 +108,11 @@ fn mp() {
     assert!(cmd.contains("--node-rank 0"));
     assert!(cmd.contains("--master-addr 1"));
     assert!(cmd.contains("--master-port 25000"));
-    assert!(cmd.contains("--distributed-executor-backend mp"));
+    // vLLM auto-detects mp; only explicitly pass for ray
+    assert!(
+        !cmd.contains("--distributed-executor-backend"),
+        "mp backend should be auto-detected"
+    );
     assert!(!cmd.contains("RAY_ADDRESS"));
     assert!(cmd.contains("--rm"), "default --rm should be present");
     // New: defaults & cluster env