[model-gateway] feat: add DAG parallel execution support and workflow optimization (#14999)

This commit is contained in:
Simo Lin
2025-12-12 08:31:12 -08:00
committed by GitHub
parent 10c68f6236
commit 306e5b8d0b
13 changed files with 768 additions and 193 deletions
+20 -14
View File
@@ -18,7 +18,14 @@ use axum::{
use sgl_model_gateway::{
app_context::AppContext,
config::RouterConfig,
core::steps::{create_wasm_module_registration_workflow, create_wasm_module_removal_workflow},
core::{
steps::{create_wasm_module_registration_workflow, create_wasm_module_removal_workflow},
LoadMonitor, WorkerRegistry,
},
data_connector::{
MemoryConversationItemStorage, MemoryConversationStorage, MemoryResponseStorage,
},
policies::PolicyRegistry,
routers::RouterFactory,
server::{build_app, AppState},
wasm::{
@@ -46,15 +53,6 @@ async fn create_test_context_with_wasm() -> Arc<AppContext> {
// Create AppContext with wasm_manager from the start
let client = reqwest::Client::new();
// Initialize registries
use sgl_model_gateway::{
core::{LoadMonitor, WorkerRegistry},
data_connector::{
MemoryConversationItemStorage, MemoryConversationStorage, MemoryResponseStorage,
},
policies::PolicyRegistry,
};
let worker_registry = Arc::new(WorkerRegistry::new());
let policy_registry = Arc::new(PolicyRegistry::new(config.policy.clone()));
@@ -116,10 +114,18 @@ async fn create_test_context_with_wasm() -> Arc<AppContext> {
workflow::WorkflowEngine,
};
let engine = Arc::new(WorkflowEngine::new());
engine.register_workflow(create_worker_registration_workflow(&config));
engine.register_workflow(create_worker_removal_workflow());
engine.register_workflow(create_wasm_module_registration_workflow());
engine.register_workflow(create_wasm_module_removal_workflow());
engine
.register_workflow(create_worker_registration_workflow(&config))
.expect("worker_registration workflow should be valid");
engine
.register_workflow(create_worker_removal_workflow())
.expect("worker_removal workflow should be valid");
engine
.register_workflow(create_wasm_module_registration_workflow())
.expect("wasm_module_registration workflow should be valid");
engine
.register_workflow(create_wasm_module_removal_workflow())
.expect("wasm_module_removal workflow should be valid");
app_context
.workflow_engine
.set(engine)