refactor: workflow_service改名app
This commit is contained in:
@@ -148,7 +148,7 @@ python test_persistence.py
|
|||||||
### 3. API 使用
|
### 3. API 使用
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from workflow_service.comfy.comfy_server import server_manager
|
from app.comfy.comfy_server import server_manager
|
||||||
|
|
||||||
# 注册服务器
|
# 注册服务器
|
||||||
await server_manager.register_server(
|
await server_manager.register_server(
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ from typing import Any, Optional
|
|||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
|
||||||
from workflow_service.comfy.comfy_workflow import ComfyWorkflow
|
from app.comfy.comfy_workflow import ComfyWorkflow
|
||||||
from workflow_service.comfy.comfy_run import ComfyRun
|
from app.comfy.comfy_run import ComfyRun
|
||||||
from workflow_service.config import Settings
|
from app.config import Settings
|
||||||
from workflow_service.comfy.comfy_server import server_manager, ComfyUIServerInfo
|
from app.comfy.comfy_server import server_manager, ComfyUIServerInfo
|
||||||
|
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
|
|
||||||
@@ -125,11 +125,10 @@ class WorkflowQueueManager:
|
|||||||
|
|
||||||
# 格式化状态信息,提高可读性
|
# 格式化状态信息,提高可读性
|
||||||
status_info = (
|
status_info = (
|
||||||
f"⏰ 定时检测触发 [{timestamp}]\n"
|
f"⏰ 定时检测触发 [{timestamp}]\t"
|
||||||
f" 📋 待处理任务: {pending_count} 个\n"
|
f"待处理/运行中: {pending_count}/{running_count}\t"
|
||||||
f" 🚀 运行中任务: {running_count} 个\n"
|
f"监控间隔: {self._monitor_interval} 秒\t"
|
||||||
f" ⏱️ 监控间隔: {self._monitor_interval} 秒\n"
|
f"🕐 {time_since_last_processing}"
|
||||||
f" 🕐 {time_since_last_processing}"
|
|
||||||
)
|
)
|
||||||
logger.info(status_info)
|
logger.info(status_info)
|
||||||
|
|
||||||
@@ -8,9 +8,9 @@ import aiohttp
|
|||||||
import websockets
|
import websockets
|
||||||
from aiohttp import ClientTimeout
|
from aiohttp import ClientTimeout
|
||||||
|
|
||||||
from workflow_service.comfy.comfy_workflow import ComfyWorkflow, API_OUTPUT_PREFIX
|
from app.comfy.comfy_workflow import ComfyWorkflow, API_OUTPUT_PREFIX
|
||||||
from workflow_service.comfy.comfy_server import ComfyUIServerInfo, server_manager
|
from app.comfy.comfy_server import ComfyUIServerInfo, server_manager
|
||||||
from workflow_service.database.api import (
|
from app.database.api import (
|
||||||
create_workflow_run,
|
create_workflow_run,
|
||||||
create_workflow_run_nodes,
|
create_workflow_run_nodes,
|
||||||
get_workflow_run,
|
get_workflow_run,
|
||||||
@@ -13,8 +13,8 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
|||||||
from sqlalchemy import select, update, delete
|
from sqlalchemy import select, update, delete
|
||||||
from sqlalchemy.orm import selectinload
|
from sqlalchemy.orm import selectinload
|
||||||
|
|
||||||
from workflow_service.database.connection import AsyncSessionLocal
|
from app.database.connection import AsyncSessionLocal
|
||||||
from workflow_service.database.models import ComfyUIServer as ComfyUIServerModel
|
from app.database.models import ComfyUIServer as ComfyUIServerModel
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -3,7 +3,7 @@ from typing import Any, Dict, List, Optional, Union
|
|||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from workflow_service.comfy.comfy_server import ComfyUIServerInfo
|
from app.comfy.comfy_server import ComfyUIServerInfo
|
||||||
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
@@ -7,7 +7,7 @@ from sqlalchemy import create_engine
|
|||||||
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession, async_sessionmaker
|
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession, async_sessionmaker
|
||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
|
|
||||||
from workflow_service.config import Settings
|
from app.config import Settings
|
||||||
|
|
||||||
# 数据库配置
|
# 数据库配置
|
||||||
DATABASE_FILE = Settings().DB_FILE
|
DATABASE_FILE = Settings().DB_FILE
|
||||||
@@ -7,11 +7,11 @@ from fastapi import FastAPI
|
|||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
from fastapi.staticfiles import StaticFiles
|
from fastapi.staticfiles import StaticFiles
|
||||||
|
|
||||||
from workflow_service.comfy.comfy_server import server_manager
|
from app.comfy.comfy_server import server_manager
|
||||||
from workflow_service.database.api import init_db
|
from app.database.api import init_db
|
||||||
from workflow_service.config import Settings
|
from app.config import Settings
|
||||||
from workflow_service.routes import service, workflow, run, runx, comfy_server
|
from app.routes import service, workflow, run, runx, comfy_server
|
||||||
from workflow_service.comfy.comfy_queue import queue_manager
|
from app.comfy.comfy_queue import queue_manager
|
||||||
|
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
|
|
||||||
@@ -5,7 +5,7 @@ import logging
|
|||||||
import aiohttp
|
import aiohttp
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from workflow_service.comfy.comfy_server import server_manager
|
from app.comfy.comfy_server import server_manager
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -5,9 +5,9 @@ from datetime import datetime, timedelta
|
|||||||
from fastapi import APIRouter, Body, HTTPException
|
from fastapi import APIRouter, Body, HTTPException
|
||||||
from fastapi.responses import JSONResponse
|
from fastapi.responses import JSONResponse
|
||||||
|
|
||||||
from workflow_service.comfy.comfy_queue import queue_manager
|
from app.comfy.comfy_queue import queue_manager
|
||||||
from workflow_service.comfy.comfy_workflow import ComfyWorkflow
|
from app.comfy.comfy_workflow import ComfyWorkflow
|
||||||
from workflow_service.database.api import (
|
from app.database.api import (
|
||||||
get_workflow,
|
get_workflow,
|
||||||
get_workflow_run,
|
get_workflow_run,
|
||||||
get_workflow_run_nodes,
|
get_workflow_run_nodes,
|
||||||
@@ -3,9 +3,9 @@ from typing import Optional
|
|||||||
|
|
||||||
from fastapi import Body, HTTPException
|
from fastapi import Body, HTTPException
|
||||||
from fastapi.responses import JSONResponse
|
from fastapi.responses import JSONResponse
|
||||||
from workflow_service.comfy.comfy_queue import queue_manager
|
from app.comfy.comfy_queue import queue_manager
|
||||||
from workflow_service.comfy.comfy_workflow import ComfyWorkflow
|
from app.comfy.comfy_workflow import ComfyWorkflow
|
||||||
from workflow_service.database.api import get_workflow
|
from app.database.api import get_workflow
|
||||||
from ._base import runx_router
|
from ._base import runx_router
|
||||||
|
|
||||||
RUNX_NAME = "model_with_multi_dress"
|
RUNX_NAME = "model_with_multi_dress"
|
||||||
@@ -6,9 +6,9 @@ import aiohttp
|
|||||||
from fastapi import APIRouter, HTTPException, Path
|
from fastapi import APIRouter, HTTPException, Path
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from workflow_service.comfy.comfy_queue import queue_manager
|
from app.comfy.comfy_queue import queue_manager
|
||||||
from workflow_service.comfy.comfy_server import server_manager
|
from app.comfy.comfy_server import server_manager
|
||||||
from workflow_service.config import Settings
|
from app.config import Settings
|
||||||
|
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
|
|
||||||
@@ -4,8 +4,8 @@ from typing import Optional, List
|
|||||||
from fastapi import APIRouter, Body, HTTPException, Path
|
from fastapi import APIRouter, Body, HTTPException, Path
|
||||||
from fastapi.responses import JSONResponse
|
from fastapi.responses import JSONResponse
|
||||||
|
|
||||||
from workflow_service.comfy.comfy_workflow import ComfyWorkflow
|
from app.comfy.comfy_workflow import ComfyWorkflow
|
||||||
from workflow_service.database.api import (
|
from app.database.api import (
|
||||||
save_workflow,
|
save_workflow,
|
||||||
get_all_workflows,
|
get_all_workflows,
|
||||||
delete_workflow,
|
delete_workflow,
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import boto3
|
import boto3
|
||||||
from workflow_service.config import Settings
|
from app.config import Settings
|
||||||
import asyncio
|
import asyncio
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import modal
|
import modal
|
||||||
from dotenv import dotenv_values
|
from dotenv import dotenv_values
|
||||||
from workflow_service.main import web_app
|
from app.main import web_app
|
||||||
|
|
||||||
fastapi_image = (
|
fastapi_image = (
|
||||||
modal.Image.debian_slim(python_version="3.11")
|
modal.Image.debian_slim(python_version="3.11")
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ project_root = os.path.dirname(os.path.abspath(__file__))
|
|||||||
sys.path.insert(0, project_root)
|
sys.path.insert(0, project_root)
|
||||||
|
|
||||||
# 现在可以正常导入
|
# 现在可以正常导入
|
||||||
from workflow_service.main import web_app
|
from app.main import web_app
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
print("🚀 启动 ComfyUI 工作流服务监控...")
|
print("🚀 启动 ComfyUI 工作流服务监控...")
|
||||||
|
|||||||
Reference in New Issue
Block a user