Fix job cancellation cleanup

- Workers are freed immediately when jobs are cancelled
- Clean up active jobs in cluster master when cancelling processing jobs
- Remove unnecessary cleanup from restart (handled by cancel)
parent c633ee4d
......@@ -72,12 +72,17 @@ class QueueManager:
if job['status'] not in ['queued', 'processing']:
return False
# If job was processing, clean up any active job for this queue_id
if job['status'] == 'processing':
from vidai.cluster_master import cluster_master
for job_id, job_info in cluster_master.active_jobs.items():
if job_info.get('queue_id') == queue_id:
cluster_master.complete_job(job_id)
break
# Update status to cancelled
update_queue_status(queue_id, 'cancelled')
# If job was processing, we might need to notify workers to stop
# For now, just mark as cancelled - workers should check status periodically
return True
def restart_job(self, queue_id: int, user_id: int = None) -> bool:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment