Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit c8ed180

Browse files
authored
add group id to variable substitution (#331)
1 parent 77422ec commit c8ed180

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

crates/orchestrator/src/status_update/plugins/node_groups.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,8 @@ impl SchedulerPlugin for NodeGroupsPlugin {
301301
let new_value = value
302302
.replace("${GROUP_INDEX}", &node_group_index.to_string())
303303
.replace("${GROUP_SIZE}", &group.nodes.len().to_string())
304-
.replace("${NEXT_P2P_ADDRESS}", &next_p2p_id);
304+
.replace("${NEXT_P2P_ADDRESS}", &next_p2p_id)
305+
.replace("${GROUP_ID}", &group.id);
305306

306307
*value = new_value;
307308
}
@@ -312,6 +313,7 @@ impl SchedulerPlugin for NodeGroupsPlugin {
312313
arg.replace("${GROUP_INDEX}", &node_group_index.to_string())
313314
.replace("${GROUP_SIZE}", &group.nodes.len().to_string())
314315
.replace("${NEXT_P2P_ADDRESS}", &next_p2p_id)
316+
.replace("${GROUP_ID}", &group.id)
315317
})
316318
.collect::<Vec<String>>()
317319
});
@@ -424,7 +426,7 @@ mod tests {
424426

425427
#[tokio::test]
426428
async fn test_group_scheduling() {
427-
let store = Arc::new(RedisStore::new_test());
429+
let store: Arc<RedisStore> = Arc::new(RedisStore::new_test());
428430
let context_store = store.clone();
429431
let store_context = Arc::new(StoreContext::new(context_store));
430432

@@ -444,6 +446,7 @@ mod tests {
444446
env_vars.insert("LOCAL_RANK".to_string(), "0".to_string());
445447
env_vars.insert("RANK".to_string(), "${GROUP_INDEX}".to_string());
446448
env_vars.insert("WORLD_SIZE".to_string(), "${GROUP_SIZE}".to_string());
449+
env_vars.insert("GROUP_ID".to_string(), "${GROUP_ID}".to_string());
447450

448451
let task1 = Task {
449452
id: Uuid::new_v4(),
@@ -458,6 +461,8 @@ mod tests {
458461
"model/Qwen3-14B-${GROUP_INDEX}.${GROUP_SIZE}".to_string(),
459462
"--top-p".to_string(),
460463
"0.95".to_string(),
464+
"--group-id".to_string(),
465+
"${GROUP_ID}".to_string(),
461466
]),
462467
state: TaskState::PENDING,
463468
created_at: 0,
@@ -483,6 +488,7 @@ mod tests {
483488
assert_eq!(env_vars.get("RANK").unwrap(), "0");
484489
assert_eq!(env_vars.get("WORLD_SIZE").unwrap(), "2");
485490
assert_eq!(task.args.as_ref().unwrap()[3], "model/Qwen3-14B-0.2");
491+
assert_ne!(env_vars.get("GROUP_ID").unwrap(), "${GROUP_ID}");
486492

487493
let filtered_tasks = plugin.filter_tasks(&tasks, &node2.address);
488494
assert_eq!(filtered_tasks.len(), 1);
@@ -492,6 +498,7 @@ mod tests {
492498
assert_eq!(env_vars.get("RANK").unwrap(), "1");
493499
assert_eq!(env_vars.get("WORLD_SIZE").unwrap(), "2");
494500
assert_eq!(task.args.as_ref().unwrap()[3], "model/Qwen3-14B-1.2");
501+
assert_ne!(env_vars.get("GROUP_ID").unwrap(), "${GROUP_ID}");
495502
}
496503

497504
#[tokio::test]

0 commit comments

Comments
 (0)