feat: 任务可调并发、可批量操作,导航栏可收缩
This commit is contained in:
@@ -280,6 +280,23 @@ async def resume_job(job_id: str) -> dict:
|
||||
return job.snapshot()
|
||||
|
||||
|
||||
@router.put("/jobs/{job_id}/concurrency")
|
||||
async def update_concurrency(job_id: str, body: dict) -> dict:
|
||||
state.require_client()
|
||||
if not isinstance(body, dict):
|
||||
raise _bad("并发格式不正确")
|
||||
try:
|
||||
value = int(body.get("concurrency"))
|
||||
except (TypeError, ValueError) as exc:
|
||||
raise _bad("并发需要是 1 到 32 的整数") from exc
|
||||
try:
|
||||
job = state.jobs.get(job_id)
|
||||
state.jobs.set_concurrency(job, value)
|
||||
except NqiError as exc:
|
||||
raise _bad(str(exc), 404 if str(exc) == "任务不存在" else 400) from exc
|
||||
return job.snapshot()
|
||||
|
||||
|
||||
@router.post("/jobs/{job_id}/pause")
|
||||
async def pause_job(job_id: str) -> dict:
|
||||
state.require_client()
|
||||
|
||||
Reference in New Issue
Block a user