mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-06 01:38:12 +08:00
Added STOPPING status to monitor
This commit is contained in:
+9
-7
@@ -19,9 +19,9 @@ def monitor(run_once=False):
|
|||||||
try:
|
try:
|
||||||
redis_client.ping()
|
redis_client.ping()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(term.red('Can not connect to Redis server.'))
|
print(term.red('Can not connect to Redis server.'))
|
||||||
logger.exception(e)
|
logger.exception(e)
|
||||||
return
|
return
|
||||||
with term.fullscreen(), term.hidden_cursor(), term.cbreak():
|
with term.fullscreen(), term.hidden_cursor(), term.cbreak():
|
||||||
val = None
|
val = None
|
||||||
start_width = int(term.width / 8)
|
start_width = int(term.width / 8)
|
||||||
@@ -45,13 +45,15 @@ def monitor(run_once=False):
|
|||||||
for stat in stats:
|
for stat in stats:
|
||||||
# color status
|
# color status
|
||||||
if stat.status == Conf.WORKING:
|
if stat.status == Conf.WORKING:
|
||||||
status = term.green(Conf.WORKING)
|
status = term.green(str(Conf.WORKING))
|
||||||
|
elif stat.status == Conf.STOPPING:
|
||||||
|
status = term.yellow(str(Conf.STOPPING))
|
||||||
elif stat.status == Conf.STOPPED:
|
elif stat.status == Conf.STOPPED:
|
||||||
status = term.red(Conf.STOPPED)
|
status = term.red(str(Conf.STOPPED))
|
||||||
elif stat.status == Conf.IDLE:
|
elif stat.status == Conf.IDLE:
|
||||||
status = Conf.IDLE
|
status = str(Conf.IDLE)
|
||||||
else:
|
else:
|
||||||
status = term.yellow(stat.status)
|
status = term.yellow(str(stat.status))
|
||||||
# color q's
|
# color q's
|
||||||
tasks = stat.task_q_size
|
tasks = stat.task_q_size
|
||||||
if tasks > 0:
|
if tasks > 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user