(self, domain: str, task_id: str)
| 584 | return bool(task and task.get("cancel_requested")) |
| 585 | |
| 586 | def request_domain_task_pause(self, domain: str, task_id: str) -> Optional[Dict[str, Any]]: |
| 587 | with _domain_lock: |
| 588 | task = self._ensure_domain_task_locked(domain=domain, task_id=task_id) |
| 589 | status = str(task.get("status") or "").strip().lower() |
| 590 | if status in {"completed", "failed", "cancelled"}: |
| 591 | return self._domain_task_snapshot(task) |
| 592 | task["pause_requested"] = True |
| 593 | task["paused"] = True |
| 594 | if status in {"pending", "running", "paused"}: |
| 595 | task["status"] = "paused" |
| 596 | task["message"] = "任务已暂停,等待继续" |
| 597 | return self._domain_task_snapshot(task) |
| 598 | |
| 599 | def request_domain_task_resume(self, domain: str, task_id: str) -> Optional[Dict[str, Any]]: |
| 600 | with _domain_lock: |
no test coverage detected