MCPcopy
hub / github.com/FujiwaraChoki/MoneyPrinter / request_cancel

Function request_cancel

Backend/repository.py:72–94  ·  view source on GitHub ↗
(session: Session, job_id: str)

Source from the content-addressed store, hash-verified

70
71
72def request_cancel(session: Session, job_id: str) -> bool:
73 job = get_job(session, job_id)
74 if not job:
75 return False
76
77 if job.status in ("completed", "failed", "cancelled"):
78 return True
79
80 job.cancel_requested = True
81 job.updated_at = utcnow()
82 append_event(
83 session, job.id, "cancel_requested", "warning", "Cancellation requested."
84 )
85
86 if job.status == "queued":
87 job.status = "cancelled"
88 job.completed_at = utcnow()
89 append_event(
90 session, job.id, "cancelled", "warning", "Job cancelled before execution."
91 )
92
93 session.commit()
94 return True
95
96
97def claim_next_queued_job(session: Session) -> Optional[GenerationJob]:

Calls 3

get_jobFunction · 0.85
utcnowFunction · 0.85
append_eventFunction · 0.85