feat(job): D2 全市场选股 Job 化(kind=selection 异步)
- Job kind=selection:executor 分支用 SelectionService(spec=SelectionQuery),结果 落 result_json、自动归档 Experiment(summary:as_of + 选出 N);/api/jobs 与 /api/experiments 的 result 解码支持 SelectionResult - POST /api/selections/jobs:提交 SelectionQuery 为异步 Job(BackgroundTasks/subprocess) - Web 选股页新增「异步(全市场)」按钮:提交 Job → waitJob 轮询结果(解决同步 60s+) - tests/test_selection_job.py:executor 执行归档(SelectionResult/Experiment kind)、 API 提交→轮询→结果与实验列表;全量 pytest + tsc 通过
This commit is contained in:
@@ -36,8 +36,12 @@ router = APIRouter(prefix="/jobs", tags=["jobs"])
|
||||
|
||||
|
||||
def _decode_result(kind: str, result_json: str | None):
|
||||
from app.domain.entities.selection import SelectionResult
|
||||
|
||||
if result_json is None:
|
||||
return None
|
||||
if kind == "selection":
|
||||
return SelectionResult.model_validate_json(result_json)
|
||||
model = BacktestResult if kind == "backtest" else FactorTestReport
|
||||
return model.model_validate_json(result_json)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user