Skip to content

Commit d35fbdc

Browse files
committed
Merge branch 'release/0.11.4'
2 parents c0d9510 + a890021 commit d35fbdc

3 files changed

Lines changed: 30 additions & 3 deletions

File tree

gridmap/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def get_memory_usage(pid):
106106
"""
107107

108108
p = Process(pid)
109-
return float(p.get_memory_usage()[0]) / (1024.0 ** 2.0)
109+
return float(p.get_memory_info()[0]) / (1024.0 ** 2.0)
110110

111111

112112
def get_cpu_load(pid):

gridmap/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@
2828
:organization: ETS
2929
'''
3030

31-
__version__ = '0.11.3'
31+
__version__ = '0.11.4'
3232
VERSION = tuple(int(x) for x in __version__.split('.'))

tests/test_gridmap.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
from __future__ import print_function, unicode_literals
2424

2525
import logging
26+
from time import sleep
2627

27-
from gridmap import Job, process_jobs, grid_map
28+
import gridmap
29+
from gridmap import Job, process_jobs, grid_map, HEARTBEAT_FREQUENCY
2830

2931
from nose.tools import eq_
3032

@@ -33,6 +35,16 @@
3335
logging.captureWarnings(True)
3436
logging.basicConfig(format=('%(asctime)s - %(name)s - %(levelname)s - ' +
3537
'%(message)s'), level=logging.DEBUG)
38+
logger = logging.getLogger(__name__)
39+
logger.debug('Path to gridmap: %s', gridmap)
40+
41+
42+
def compute_factorial_slow(n):
43+
sleep(HEARTBEAT_FREQUENCY + 1)
44+
ret = 1
45+
for i in range(n):
46+
ret = ret * (i + 1)
47+
return ret
3648

3749

3850
def compute_factorial(n):
@@ -49,6 +61,13 @@ def test_map():
4961
eq_(expected, outputs)
5062

5163

64+
def test_map_slow():
65+
inputs = [1, 2, 4, 8, 16]
66+
expected = list(map(compute_factorial_slow, inputs))
67+
outputs = grid_map(compute_factorial_slow, inputs, quiet=False)
68+
eq_(expected, outputs)
69+
70+
5271
def make_jobs(inputvec, function):
5372
# create empty job vector
5473
jobs = []
@@ -69,3 +88,11 @@ def test_process_jobs():
6988
function_jobs = make_jobs(inputs, compute_factorial)
7089
outputs = process_jobs(function_jobs, quiet=False)
7190
eq_(expected, outputs)
91+
92+
93+
def test_process_jobs_slow():
94+
inputs = [1, 2, 4, 8, 16]
95+
expected = list(map(compute_factorial_slow, inputs))
96+
function_jobs = make_jobs(inputs, compute_factorial_slow)
97+
outputs = process_jobs(function_jobs, quiet=False)
98+
eq_(expected, outputs)

0 commit comments

Comments
 (0)