show current worker job (alongside with minor cosmetic column tweaks) (#4262)

This commit is contained in:
Omer Lachish 2019-10-23 11:20:15 +03:00 committed by Arik Fraimovich
parent 5d58503623
commit 612833404b
2 changed files with 12 additions and 5 deletions

View File

@ -24,9 +24,11 @@ const workersColumns = [Columns.custom(
/> {value}
</span>
), { title: 'State', dataIndex: 'state' },
)].concat(map(['Hostname', 'PID', 'Name', 'Queues', 'Successful Job Count',
'Failed Job Count', 'Birth Date', 'Total Working Time'],
c => ({ title: c, dataIndex: c.toLowerCase().replace(/\s/g, '_') })));
)].concat(map(['Hostname', 'PID', 'Name', 'Queues', 'Current Job', 'Successful Jobs', 'Failed Jobs'],
c => ({ title: c, dataIndex: c.toLowerCase().replace(/\s/g, '_') }))).concat([
Columns.dateTime({ title: 'Birth Date', dataIndex: 'birth_date' }),
Columns.duration({ title: 'Total Working Time', dataIndex: 'total_working_time' }),
]);
const queuesColumns = map(
['Name', 'Started', 'Queued'],

View File

@ -159,6 +159,10 @@ def rq_queues():
} for q in Queue.all(connection=redis_connection)}
def describe_job(job):
return '{} ({})'.format(job.id, job.func_name.split(".").pop()) if job else None
def rq_workers():
return [{
'name': w.name,
@ -168,8 +172,9 @@ def rq_workers():
'state': w.state,
'last_heartbeat': w.last_heartbeat,
'birth_date': w.birth_date,
'successful_job_count': w.successful_job_count,
'failed_job_count': w.failed_job_count,
'current_job': describe_job(w.get_current_job()),
'successful_jobs': w.successful_job_count,
'failed_jobs': w.failed_job_count,
'total_working_time': w.total_working_time
} for w in Worker.all(connection=redis_connection)]