Commit 7437dbae authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Restricted mp_alg overriding to nosetest console calls only.

parent 8795c815
Pipeline #3814 passed with stages
in 1 minute and 7 seconds
......@@ -5,7 +5,7 @@ import multiprocessing
import os
from tempfile import TemporaryDirectory
from typing import Union, Tuple, List, Any # noqa: F401
import inspect
import sys
# custom
......@@ -875,11 +875,10 @@ class SensorMapGeometryTransformer3D(object):
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 nosetest or unittest
is_called_by_nose = any(x[0].f_globals['__name__'].startswith('nose.') for x in inspect.stack())
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):
is_called_by_nose_cmd = 'nosetest' in sys.argv[0]
if self.opts['nprocs'] > 1 and self.mp_alg == 'bands' and is_called_by_nose_cmd:
warnings.warn("mp_alg='bands' causes deadlocks if SensorMapGeometryTransformer3D is called within a "
"nosetest. Using mp_alg='tiles'.")
"nosetest console call. Using mp_alg='tiles'.")
self.mp_alg = 'tiles'
Supports Markdown
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