Consistent job logging format

- Assignment: 'Assigned job 1 (job_xxx) to worker'
- Cancellation: 'Job 1 (job_xxx) cancelled'
- Waiting: 'Job 1 waiting for available workers' (no cluster id yet)
- Clear correlation between queue and cluster job IDs
parent 2f1e4f41
...@@ -1388,7 +1388,7 @@ class ClusterMaster: ...@@ -1388,7 +1388,7 @@ class ClusterMaster:
job_id = await self.assign_job_to_worker(worker_key, job['data'], queue_id=job['id']) job_id = await self.assign_job_to_worker(worker_key, job['data'], queue_id=job['id'])
if job_id: if job_id:
update_queue_status(job['id'], 'processing', {'job_id': job_id, 'status': 'Assigned to worker'}, job_id=job_id) update_queue_status(job['id'], 'processing', {'job_id': job_id, 'status': 'Assigned to worker'}, job_id=job_id)
print(f"Assigned job {job['id']} to worker {worker_key} with job_id {job_id}") print(f"Assigned job {job['id']} ({job_id}) to worker {worker_key}")
else: else:
print(f"Failed to assign job {job['id']} to worker {worker_key}, re-queuing") print(f"Failed to assign job {job['id']} to worker {worker_key}, re-queuing")
update_queue_status(job['id'], 'queued', error='Failed to assign to worker, re-queued') update_queue_status(job['id'], 'queued', error='Failed to assign to worker, re-queued')
......
...@@ -86,7 +86,10 @@ class QueueManager: ...@@ -86,7 +86,10 @@ class QueueManager:
# Update status to cancelled # Update status to cancelled
update_queue_status(queue_id, 'cancelled') update_queue_status(queue_id, 'cancelled')
print(f"Job {cancelled_job_id or queue_id} cancelled") if cancelled_job_id:
print(f"Job {queue_id} ({cancelled_job_id}) cancelled")
else:
print(f"Job {queue_id} cancelled")
return True return True
......
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