fix(rohs-check): 修复检核任务禁用状态处理及错误信息
This commit is contained in:
1 parent
25cc87fdb3
commit
3068e3abb4
15 files changed
+1407
-13
No files matched your search
@@ -13,7 +13,7 @@ from flask import Blueprint, current_app, jsonify, request, send_file
|
||||
from sqlalchemy import text
|
||||
|
||||
from app import db
|
||||
from app.errors import AppError, ConflictError, NotFoundError, ServiceUnavailableError, UnauthorizedError, ValidationError
|
||||
from app.errors import AppError, ConflictError, NotFoundError, ServiceUnavailableError, UnauthorizedError
|
||||
from app.models import ScheduleRun, ScheduleTask
|
||||
from app.services.hxops_tool_api import resolve_hxops_tool_api_base
|
||||
from app.services.rohs_check_tools.openapi_spec import build_rohs_openapi_spec
|
||||
@@ -76,7 +76,6 @@ def _tool_error_code(exc: AppError) -> str:
|
||||
"missing_auth",
|
||||
"invalid_auth",
|
||||
"task_not_found",
|
||||
"task_disabled",
|
||||
"run_not_found",
|
||||
"excel_not_ready",
|
||||
"kb_sync_failed",
|
||||
@@ -223,10 +222,9 @@ def list_rohs_tasks():
|
||||
|
||||
@rohs_check_bp.route("/tools/tasks/run", methods=["POST"])
|
||||
def run_rohs_check():
|
||||
"""立即执行检核;任务 enabled 仅控制 cron,不限制人工或 Chatflow 触发。"""
|
||||
data = request.get_json(silent=True) or {}
|
||||
task = _resolve_check_task(data)
|
||||
if not task.enabled:
|
||||
raise ValidationError("task_disabled")
|
||||
|
||||
with _RUN_START_LOCK:
|
||||
_acquire_task_start_lock(task.id)
|
||||
|
||||
Reference in new issue
Block a user