feat: 后端支持托管到 Metrix,启动自动安装并接入平台登录
This commit is contained in:
@@ -10,7 +10,7 @@ from sqlalchemy import select
|
||||
|
||||
from app.collect.io import parse_upload, write_table
|
||||
from app.collect.remote import fetch_ftp, fetch_nqi
|
||||
from app.config import postgres_conninfo, result_dir
|
||||
from app.config import inline_worker_allowed, postgres_conninfo, result_dir
|
||||
from app.db import session_scope
|
||||
from app.models import CellData, CollectionSource, ExportTask, NqiAccount, utcnow
|
||||
from app.nqi.client import NqiAuthError, NqiClient, NqiError
|
||||
@@ -204,13 +204,20 @@ def _fetch_nqi_sync(cookies: list, config: dict) -> tuple[str, bytes]:
|
||||
def enqueue_export(task_id: int) -> None:
|
||||
if _defer("decom_export", task_id=task_id):
|
||||
return
|
||||
threading.Thread(target=execute_export, args=(task_id,), daemon=True).start()
|
||||
_run_inline(execute_export, task_id)
|
||||
|
||||
|
||||
def enqueue_collection(source_id: int) -> None:
|
||||
if _defer("decom_collect", source_id=source_id):
|
||||
return
|
||||
threading.Thread(target=execute_collection, args=(source_id,), daemon=True).start()
|
||||
_run_inline(execute_collection, source_id)
|
||||
|
||||
|
||||
def _run_inline(target, item_id: int) -> None:
|
||||
if not inline_worker_allowed():
|
||||
logger.info("没有排队数据库,任务 %s 留在排队中", item_id)
|
||||
return
|
||||
threading.Thread(target=target, args=(item_id,), daemon=True).start()
|
||||
|
||||
|
||||
def _defer(name: str, **kwargs) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user