From f1ac2ff8997d35edf35cd17635011c3bfdb34b86 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Thu, 20 Mar 2014 11:22:19 -0400 Subject: [PATCH] Bug fixes for CentOS --- awx/main/management/commands/run_task_system.py | 2 +- awx/main/utils.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/awx/main/management/commands/run_task_system.py b/awx/main/management/commands/run_task_system.py index 3b0b32ef3b..9f0605f487 100644 --- a/awx/main/management/commands/run_task_system.py +++ b/awx/main/management/commands/run_task_system.py @@ -272,7 +272,7 @@ def run_taskmanager(command_port): try: message = command_socket.recv_json(flags=zmq.NOBLOCK) command_socket.send("1") - except zmq.error.ZMQError,e: + except zmq.ZMQError,e: message = None if message is not None or (datetime.datetime.now() - last_rebuild).seconds > 60: if message is not None and 'pause' in message: diff --git a/awx/main/utils.py b/awx/main/utils.py index e5cdcd7de3..edfe303988 100644 --- a/awx/main/utils.py +++ b/awx/main/utils.py @@ -305,7 +305,9 @@ def get_system_task_capacity(): from django.conf import settings if hasattr(settings, 'SYSTEM_TASK_CAPACITY'): return settings.SYSTEM_TASK_CAPACITY - total_mem_value = subprocess.check_output(['free','-m']).split()[7] + proc = subprocess.Popen(['free', '-m'], stdout=subprocess.PIPE) + out,err = proc.communicate() + total_mem_value = out.split()[7] if int(total_mem_value) <= 2048: return 50 return 50 + ((int(total_mem_value) / 1024) - 2) * 75