From abc8b397fc8366f389fb47dd2bf48eb980529146 Mon Sep 17 00:00:00 2001 From: Jason McVetta Date: Wed, 12 Feb 2020 18:52:25 +0700 Subject: [PATCH] Revert "wider column for cluster_id, and cast to string" This reverts commit a37d3b7af04de946a1a577acaf683d6d9b85c49c. --- django_q/monitor.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/django_q/monitor.py b/django_q/monitor.py index 632c2e5..14a28a3 100644 --- a/django_q/monitor.py +++ b/django_q/monitor.py @@ -25,14 +25,13 @@ def monitor(run_once=False, broker=None): val = None start_width = int(term.width / 8) while val not in (u'q', u'Q',): - cluster_id_width = 36 # UUID4 - col_width = int((term.width - cluster_id_width) / 7) + col_width = int(term.width / 8) # In case of resize if col_width != start_width: print(term.clear()) start_width = col_width print(term.move(0, 0) + term.black_on_green(term.center(_('Host'), width=col_width - 1))) - print(term.move(0, 1 * col_width) + term.black_on_green(term.center(_('Id'), width=cluster_id_width - 1))) + print(term.move(0, 1 * col_width) + term.black_on_green(term.center(_('Id'), width=col_width - 1))) print(term.move(0, 2 * col_width) + term.black_on_green(term.center(_('State'), width=col_width - 1))) print(term.move(0, 3 * col_width) + term.black_on_green(term.center(_('Pool'), width=col_width - 1))) print(term.move(0, 4 * col_width) + term.black_on_green(term.center(_('TQ'), width=col_width - 1))) @@ -73,7 +72,7 @@ def monitor(run_once=False, broker=None): uptime = '%d:%02d:%02d' % (hours, minutes, seconds) # print to the terminal 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(str(stat.cluster_id), width=cluster_id_width - 1)) + print(term.move(i, 1 * col_width) + term.center(stat.cluster_id[:8], 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(workers, width=col_width - 1)) print(term.move(i, 4 * col_width) + term.center(tasks, width=col_width - 1))