[model-gateway] refactor: extract workflow engine to src/workflow module (#14996)
This commit is contained in:
@@ -18,9 +18,7 @@ use axum::{
|
||||
use sgl_model_gateway::{
|
||||
app_context::AppContext,
|
||||
config::RouterConfig,
|
||||
core::workflow::{
|
||||
create_wasm_module_registration_workflow, create_wasm_module_removal_workflow,
|
||||
},
|
||||
core::steps::{create_wasm_module_registration_workflow, create_wasm_module_removal_workflow},
|
||||
routers::RouterFactory,
|
||||
server::{build_app, AppState},
|
||||
wasm::{
|
||||
@@ -113,8 +111,9 @@ async fn create_test_context_with_wasm() -> Arc<AppContext> {
|
||||
.expect("JobQueue should only be initialized once");
|
||||
|
||||
// Initialize WorkflowEngine and register workflows
|
||||
use sgl_model_gateway::core::workflow::{
|
||||
create_worker_registration_workflow, create_worker_removal_workflow, WorkflowEngine,
|
||||
use sgl_model_gateway::{
|
||||
core::steps::{create_worker_registration_workflow, create_worker_removal_workflow},
|
||||
workflow::WorkflowEngine,
|
||||
};
|
||||
let engine = Arc::new(WorkflowEngine::new());
|
||||
engine.register_workflow(create_worker_registration_workflow(&config));
|
||||
@@ -684,8 +683,9 @@ async fn test_wasm_module_execution() {
|
||||
.expect("Workflow engine should be initialized");
|
||||
|
||||
// Create workflow context for registration
|
||||
use sgl_model_gateway::core::workflow::{
|
||||
steps::WasmModuleConfigRequest, WorkflowContext, WorkflowId, WorkflowInstanceId,
|
||||
use sgl_model_gateway::{
|
||||
core::steps::WasmModuleConfigRequest,
|
||||
workflow::{WorkflowContext, WorkflowId, WorkflowInstanceId},
|
||||
};
|
||||
|
||||
let descriptor = WasmModuleDescriptor {
|
||||
@@ -727,14 +727,14 @@ async fn test_wasm_module_execution() {
|
||||
.expect("Failed to get workflow status");
|
||||
|
||||
match state.status {
|
||||
sgl_model_gateway::core::workflow::WorkflowStatus::Completed => {
|
||||
sgl_model_gateway::workflow::WorkflowStatus::Completed => {
|
||||
// Extract module UUID from context
|
||||
if let Some(uuid_arc) = state.context.get::<Uuid>("module_uuid") {
|
||||
module_uuid = Some(*uuid_arc.as_ref());
|
||||
}
|
||||
break;
|
||||
}
|
||||
sgl_model_gateway::core::workflow::WorkflowStatus::Failed => {
|
||||
sgl_model_gateway::workflow::WorkflowStatus::Failed => {
|
||||
panic!("Workflow failed: {:?}", state);
|
||||
}
|
||||
_ => {
|
||||
|
||||
Reference in New Issue
Block a user