From d94b631e406f8997b60ff10e0fba43347dd5f6e4 Mon Sep 17 00:00:00 2001 From: Ilan Steemers Date: Mon, 29 Jun 2015 11:36:30 +0200 Subject: [PATCH] Limited hostname width in monitor --- django_q/management/commands/qmonitor.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/django_q/management/commands/qmonitor.py b/django_q/management/commands/qmonitor.py index 114f96b..7e1a1bf 100644 --- a/django_q/management/commands/qmonitor.py +++ b/django_q/management/commands/qmonitor.py @@ -53,16 +53,14 @@ def monitor(run_once=False): hours, remainder = divmod(uptime, 3600) minutes, seconds = divmod(remainder, 60) uptime = '%d:%02d:%02d' % (hours, minutes, seconds) - print(term.move(i, 0) + term.center('{}'.format(stat.host), width=col_width - 1)) - print(term.move(i, 1 * col_width) + term.center('{}'.format(stat.cluster_id), width=col_width - 1)) - print(term.move(i, 2 * col_width) + term.center('{}'.format(status), width=col_width - 1)) - print( - term.move(i, 3 * col_width) + term.center('{}'.format(len(stat.workers)), width=col_width - 1)) - print(term.move(i, 4 * col_width) + term.center('{}'.format(stat.task_q_size), width=col_width - 1)) - print(term.move(i, 5 * col_width) + term.center('{}'.format(stat.done_q_size), width=col_width - 1)) - print(term.move(i, 6 * col_width) + term.center('{}'.format(stat.reincarnations), - width=col_width - 1)) - print(term.move(i, 7 * col_width) + term.center('{}'.format(uptime), width=col_width - 1)) + print(term.move(i, 0) + term.center(stat.host[:col_width - 1], width=col_width - 1)) + print(term.move(i, 1 * col_width) + term.center(stat.cluster_id, width=col_width - 1)) + print(term.move(i, 2 * col_width) + term.center(status, width=col_width - 1)) + print(term.move(i, 3 * col_width) + term.center(len(stat.workers), width=col_width - 1)) + print(term.move(i, 4 * col_width) + term.center(stat.task_q_size, width=col_width - 1)) + print(term.move(i, 5 * col_width) + term.center(stat.done_q_size, width=col_width - 1)) + print(term.move(i, 6 * col_width) + term.center(stat.reincarnations, width=col_width - 1)) + print(term.move(i, 7 * col_width) + term.center(uptime, width=col_width - 1)) i += 1 # for testing if run_once: