Skip to content

Commit 6aced63

Browse files
committed
Ensure that memory and CPU values are floats
1 parent 85094e8 commit 6aced63

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

gridmap/runner.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import sys
4141
import time
4242
from io import open
43-
from subprocess import check_output
4443

4544
from psutil import Process
4645
import zmq
@@ -51,7 +50,6 @@
5150

5251
# TODO: Refactor this so that there's a class that stores socket, since creating
5352
# a new one each time is hugely wasteful.
54-
5553
def _send_zmq_msg(job_id, command, data, address):
5654
"""
5755
simple code to send messages back to host
@@ -107,7 +105,7 @@ def get_memory_usage(pid):
107105
"""
108106

109107
p = Process(pid)
110-
return p.get_memory_usage()[0] / (1024.0 ** 2.0)
108+
return float(p.get_memory_usage()[0]) / (1024.0 ** 2.0)
111109

112110

113111
def get_cpu_load(pid):
@@ -121,7 +119,7 @@ def get_cpu_load(pid):
121119
"""
122120

123121
p = Process(pid)
124-
return p.get_cpu_percent(), p.status
122+
return float(p.get_cpu_percent()), p.status
125123

126124

127125
def get_job_status(parent_pid):

0 commit comments

Comments
 (0)