Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Daniel Scheffler
py_tools_ds
Commits
7437dbae
Commit
7437dbae
authored
Mar 22, 2019
by
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
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
py_tools_ds/geo/raster/reproject.py
View file @
7437dbae
...
...
@@ -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
try
:
...
...
@@ -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'
@
staticmethod
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment