From 0fce823952b9f6e165346fd35942b33f38abbea1 Mon Sep 17 00:00:00 2001 From: Jan Oliver Oelerich Date: Wed, 20 Jan 2016 09:09:32 +0100 Subject: [PATCH] fixed a bug of running jobs not being displayed. --- i3pystatus/sge.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/i3pystatus/sge.py b/i3pystatus/sge.py index 578a6bd..989558f 100644 --- a/i3pystatus/sge.py +++ b/i3pystatus/sge.py @@ -26,15 +26,16 @@ class SGETracker(IntervalModule): color = "#ffffff" def parse_qstat_xml(self): - xml = subprocess.check_output("ssh {0} \"qstat -f -xml\"".format(self.ssh), + xml = subprocess.check_output("ssh {0} \"qstat -xml\"".format(self.ssh), stderr=subprocess.STDOUT, shell=True) root = etree.fromstring(xml) - jobs = root.xpath('//job_info/job_info/job_list') - job_dict = {'qw': 0, 'Eqw': 0, 'r': 0} + + for j in root.xpath('//job_info/job_info/job_list'): + job_dict[j.find("state").text] += 1 - for j in jobs: + for j in root.xpath('//job_info/queue_info/job_list'): job_dict[j.find("state").text] += 1 return job_dict