INNER CODE UNIT · Python

is_job_cancelled

ChenShuo2004/cs-board · webapp/server.py:503

def is_job_cancelled(job_id: str) -> bool:
    with LOCK:
        return job_id in DELETED_JOB_IDS or JOBS.get(job_id, {}).get("status") == "cancelled"


def ensure_job_active(job_id: str) -> None:
    if is_job_cancelled(job_id):
        raise JobCancelled("任务已取消")


def terminate_running_process(job_id: str) -> None:
    with RUNNING_PROCESSES_LOCK:
        process = RUNNING_PROCESSES.get(job_id)
    if process is None or process.poll() is not None:
        return
    try:
        if os.name == "nt":
            subprocess.run(

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…