Skip to content

Commit

Permalink
Merge pull request #490 from datacratic/sge_get_loads_fix
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit d022228
Author: Mich <fmlheureux@datacratic.com>
Date:   Fri Jan 30 10:40:15 2015 -0500

    Removed duplicate part

commit f488c50
Author: Mich <fmlheureux@datacratic.com>
Date:   Fri Jan 30 10:34:42 2015 -0500

    Converts no load to 0 on get_loads

commit d69ccd0
Author: Mich <fmlheureux@datacratic.com>
Date:   Fri Jan 30 10:23:52 2015 -0500

    Added comment about the load_avg operation

commit 81e544c
Author: Mich <fmlheureux@datacratic.com>
Date:   Fri Jan 30 10:23:12 2015 -0500

    try/except instead of isinstance for load avg check

commit de3f313
Author: Mich <fmlheureux@datacratic.com>
Date:   Thu Jan 29 15:19:39 2015 -0500

    Fix a crash that occurs when nodes load factor exceeds 999

closes #490
  • Loading branch information
jtriley committed Jan 30, 2015
1 parent ca9d1b8 commit b4d1ad4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions starcluster/balancers/sge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,16 @@ def get_loads(self):
"""
loads = []
for h in self.hosts:
if h['load_avg'] == '-':
h['load_avg'] = 0
loads.append(h['load_avg'])
load_avg = h['load_avg']
try:
if load_avg == "-":
load_avg = 0
elif load_avg[-1] == 'K':
load_avg = float(load_avg[:-1]) * 1000
except TypeError:
# load_avg was already a number
pass
loads.append(load_avg)
return loads

def _add(self, x, y):
Expand Down

0 comments on commit b4d1ad4

Please sign in to comment.