Commit 8795c815 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Also include unittest in mp_alg overriding.

parent 92636c0d
Pipeline #3813 passed with stages
in 1 minute and 9 seconds
......@@ -874,9 +874,10 @@ class SensorMapGeometryTransformer3D(object):
self.opts['nprocs'] = opts.get('nprocs', multiprocessing.cpu_count())
self.mp_alg = ('bands' if self.lons.shape[2] >= opts['nprocs'] else 'tiles') if mp_alg == 'auto' else mp_alg
# override self.mp_alg if SensorMapGeometryTransformer3D is called by nosetests
# override self.mp_alg if SensorMapGeometryTransformer3D is called by nosetest or unittest
is_called_by_nose = any(x[0].f_globals['__name__'].startswith('nose.') for x in inspect.stack())
if self.opts['nprocs'] > 1 and self.mp_alg == 'bands' and is_called_by_nose:
is_called_by_unittest = any(x[0].f_globals['__name__'].startswith('unittest.') for x in inspect.stack())
if self.opts['nprocs'] > 1 and self.mp_alg == 'bands' and (is_called_by_nose or is_called_by_unittest):
warnings.warn("mp_alg='bands' causes deadlocks if SensorMapGeometryTransformer3D is called within a "
"nosetest. Using mp_alg='tiles'.")
self.mp_alg = 'tiles'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment