From 1a08f099a03d184f0af25a044d5351e06d6e3960 Mon Sep 17 00:00:00 2001 From: madsmpedersen <m@madsp.dk> Date: Thu, 7 Apr 2016 11:01:47 +0200 Subject: [PATCH] processes starting with <process name> counting as own process --- wetb/utils/cluster_tools/cluster_resource.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wetb/utils/cluster_tools/cluster_resource.py b/wetb/utils/cluster_tools/cluster_resource.py index 78bc9eb9..4c5cc151 100644 --- a/wetb/utils/cluster_tools/cluster_resource.py +++ b/wetb/utils/cluster_tools/cluster_resource.py @@ -69,9 +69,9 @@ class LocalResource(Resource): try: return psutil.Process(i).name except psutil._error.AccessDenied: - pass + return "" no_cpu = multiprocessing.cpu_count() cpu_free = (1 - psutil.cpu_percent(.5) / 100) * no_cpu - no_current_process = len([i for i in psutil.get_pid_list() if name(i) == self.process_name]) + no_current_process = len([i for i in psutil.get_pid_list() if name(i).lower().startswith(self.process_name.lower())]) return no_cpu, cpu_free, no_current_process -- GitLab