refactor: workflow_service改名app

This commit is contained in:
iHeyTang
2025-08-22 15:15:54 +08:00
parent 6ace2ed3c0
commit cf76f4af0d
25 changed files with 36 additions and 37 deletions

View File

@@ -148,7 +148,7 @@ python test_persistence.py
### 3. API 使用
```python
from workflow_service.comfy.comfy_server import server_manager
from app.comfy.comfy_server import server_manager
# 注册服务器
await server_manager.register_server(

View File

@@ -4,10 +4,10 @@ from typing import Any, Optional
import aiohttp
from workflow_service.comfy.comfy_workflow import ComfyWorkflow
from workflow_service.comfy.comfy_run import ComfyRun
from workflow_service.config import Settings
from workflow_service.comfy.comfy_server import server_manager, ComfyUIServerInfo
from app.comfy.comfy_workflow import ComfyWorkflow
from app.comfy.comfy_run import ComfyRun
from app.config import Settings
from app.comfy.comfy_server import server_manager, ComfyUIServerInfo
settings = Settings()
@@ -125,11 +125,10 @@ class WorkflowQueueManager:
# 格式化状态信息,提高可读性
status_info = (
f"⏰ 定时检测触发 [{timestamp}]\n"
f" 📋 待处理任务: {pending_count}\n"
f" 🚀 运行中任务: {running_count} \n"
f" ⏱️ 监控间隔: {self._monitor_interval}\n"
f" 🕐 {time_since_last_processing}"
f"⏰ 定时检测触发 [{timestamp}]\t"
f"待处理/运行中: {pending_count}/{running_count}\t"
f"监控间隔: {self._monitor_interval} \t"
f"🕐 {time_since_last_processing}"
)
logger.info(status_info)

View File

@@ -8,9 +8,9 @@ import aiohttp
import websockets
from aiohttp import ClientTimeout
from workflow_service.comfy.comfy_workflow import ComfyWorkflow, API_OUTPUT_PREFIX
from workflow_service.comfy.comfy_server import ComfyUIServerInfo, server_manager
from workflow_service.database.api import (
from app.comfy.comfy_workflow import ComfyWorkflow, API_OUTPUT_PREFIX
from app.comfy.comfy_server import ComfyUIServerInfo, server_manager
from app.database.api import (
create_workflow_run,
create_workflow_run_nodes,
get_workflow_run,

View File

@@ -13,8 +13,8 @@ from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy import select, update, delete
from sqlalchemy.orm import selectinload
from workflow_service.database.connection import AsyncSessionLocal
from workflow_service.database.models import ComfyUIServer as ComfyUIServerModel
from app.database.connection import AsyncSessionLocal
from app.database.models import ComfyUIServer as ComfyUIServerModel
logger = logging.getLogger(__name__)

View File

@@ -3,7 +3,7 @@ from typing import Any, Dict, List, Optional, Union
import aiohttp
from pydantic import BaseModel
from workflow_service.comfy.comfy_server import ComfyUIServerInfo
from app.comfy.comfy_server import ComfyUIServerInfo
logging.basicConfig(level=logging.INFO)

View File

@@ -7,7 +7,7 @@ from sqlalchemy import create_engine
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession, async_sessionmaker
from sqlalchemy.orm import sessionmaker
from workflow_service.config import Settings
from app.config import Settings
# 数据库配置
DATABASE_FILE = Settings().DB_FILE

View File

@@ -7,11 +7,11 @@ from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.staticfiles import StaticFiles
from workflow_service.comfy.comfy_server import server_manager
from workflow_service.database.api import init_db
from workflow_service.config import Settings
from workflow_service.routes import service, workflow, run, runx, comfy_server
from workflow_service.comfy.comfy_queue import queue_manager
from app.comfy.comfy_server import server_manager
from app.database.api import init_db
from app.config import Settings
from app.routes import service, workflow, run, runx, comfy_server
from app.comfy.comfy_queue import queue_manager
settings = Settings()

View File

@@ -5,7 +5,7 @@ import logging
import aiohttp
import asyncio
from workflow_service.comfy.comfy_server import server_manager
from app.comfy.comfy_server import server_manager
logger = logging.getLogger(__name__)

View File

@@ -5,9 +5,9 @@ from datetime import datetime, timedelta
from fastapi import APIRouter, Body, HTTPException
from fastapi.responses import JSONResponse
from workflow_service.comfy.comfy_queue import queue_manager
from workflow_service.comfy.comfy_workflow import ComfyWorkflow
from workflow_service.database.api import (
from app.comfy.comfy_queue import queue_manager
from app.comfy.comfy_workflow import ComfyWorkflow
from app.database.api import (
get_workflow,
get_workflow_run,
get_workflow_run_nodes,

View File

@@ -3,9 +3,9 @@ from typing import Optional
from fastapi import Body, HTTPException
from fastapi.responses import JSONResponse
from workflow_service.comfy.comfy_queue import queue_manager
from workflow_service.comfy.comfy_workflow import ComfyWorkflow
from workflow_service.database.api import get_workflow
from app.comfy.comfy_queue import queue_manager
from app.comfy.comfy_workflow import ComfyWorkflow
from app.database.api import get_workflow
from ._base import runx_router
RUNX_NAME = "model_with_multi_dress"

View File

@@ -6,9 +6,9 @@ import aiohttp
from fastapi import APIRouter, HTTPException, Path
from pydantic import BaseModel
from workflow_service.comfy.comfy_queue import queue_manager
from workflow_service.comfy.comfy_server import server_manager
from workflow_service.config import Settings
from app.comfy.comfy_queue import queue_manager
from app.comfy.comfy_server import server_manager
from app.config import Settings
settings = Settings()

View File

@@ -4,8 +4,8 @@ from typing import Optional, List
from fastapi import APIRouter, Body, HTTPException, Path
from fastapi.responses import JSONResponse
from workflow_service.comfy.comfy_workflow import ComfyWorkflow
from workflow_service.database.api import (
from app.comfy.comfy_workflow import ComfyWorkflow
from app.database.api import (
save_workflow,
get_all_workflows,
delete_workflow,

View File

@@ -1,5 +1,5 @@
import boto3
from workflow_service.config import Settings
from app.config import Settings
import asyncio
settings = Settings()

View File

@@ -1,6 +1,6 @@
import modal
from dotenv import dotenv_values
from workflow_service.main import web_app
from app.main import web_app
fastapi_image = (
modal.Image.debian_slim(python_version="3.11")

View File

@@ -23,7 +23,7 @@ project_root = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, project_root)
# 现在可以正常导入
from workflow_service.main import web_app
from app.main import web_app
import uvicorn
print("🚀 启动 ComfyUI 工作流服务监控...")