Send cancel commands to workers

- Workers receive stop processing commands when jobs are cancelled
- Ensures workers halt processing immediately on cancel
- Maintains proper cleanup of resources
parent 855d427a
...@@ -72,12 +72,13 @@ class QueueManager: ...@@ -72,12 +72,13 @@ class QueueManager:
if job['status'] not in ['queued', 'processing']: if job['status'] not in ['queued', 'processing']:
return False return False
# If job was processing, clean up any active job for this queue_id # If job was processing, send cancel command to worker and clean up active job
if job['status'] == 'processing': if job['status'] == 'processing':
from vidai.cluster_master import cluster_master from vidai.cluster_master import cluster_master
for job_id, job_info in cluster_master.active_jobs.items(): for job_id, job_info in cluster_master.active_jobs.items():
if job_info.get('queue_id') == queue_id: if job_info.get('queue_id') == queue_id:
cluster_master.complete_job(job_id) # Send cancel command to worker
cluster_master._cancel_job_processing(job_id)
break break
# Update status to cancelled # Update status to cancelled
......
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