Skip to content

Commit

Permalink
show current worker job (alongside with minor cosmetic column tweaks) (
Browse files Browse the repository at this point in the history
  • Loading branch information
Omer Lachish authored and arikfr committed Oct 23, 2019
1 parent 5d58503 commit 6128334
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 5 additions & 3 deletions client/app/components/admin/RQStatus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
9 changes: 7 additions & 2 deletions redash/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)]

Expand Down

0 comments on commit 6128334

Please sign in to comment.