Store worker information in job result for display in jobs page

parent 7ef645fa
...@@ -1391,7 +1391,14 @@ class ClusterMaster: ...@@ -1391,7 +1391,14 @@ class ClusterMaster:
if worker_key: if worker_key:
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) # Include worker information in the result
worker_info = {
'job_id': job_id,
'status': 'Assigned to worker',
'worker': worker_key,
'worker_type': self.processes[worker_key]['name']
}
update_queue_status(job['id'], 'processing', worker_info, job_id=job_id)
print(f"Assigned job {job['id']} ({job_id}) to worker {worker_key}") 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")
......
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