added segments

This commit is contained in:
2026-01-09 12:10:58 -08:00
parent 55e37fbca8
commit 67357b5038
55 changed files with 2310 additions and 75 deletions

View File

@@ -220,4 +220,24 @@ class JobManager:
job.end_time = datetime.now()
db.commit()
def force_fail_job(self, job_id: str):
"""
Forcefully mark a job as failed in the database.
This does not guarantee the underlying thread stops immediately,
but it releases the UI state.
"""
with self._get_db() as db:
job = db.query(Job).filter(Job.id == job_id).first()
if job:
# We update status regardless of current state if user wants to force it
prev_status = job.status
job.status = "failed"
job.message = f"Forcefully killed by user (was {prev_status})"
job.end_time = datetime.now()
job.cancel_requested = True # Hint to thread if it's still alive
db.commit()
logger.warning(f"Job {job_id} was forcefully killed by user.")
return True
return False
job_manager = JobManager()