Commit 5587507b authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Fixed multiprocessing issue (daemonic processes are not allowed to have children).


Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent d3aea50e
Pipeline #8000 passed with stage
in 19 minutes
......@@ -77,7 +77,10 @@ class L2B_object(L2A_object):
# perform spectral homogenization of image data #
#################################################
SpH = SpectralHomogenizer(classifier_rootDir=CFG.path_spechomo_classif, logger=self.logger, CPUs=CFG.CPUs)
from ..processing.multiproc import is_mainprocess
SpH = SpectralHomogenizer(classifier_rootDir=CFG.path_spechomo_classif,
logger=self.logger,
CPUs=CFG.CPUs if is_mainprocess() else 1)
if method == 'LI' or CFG.datasetid_spectral_ref is None:
# linear interpolation (if intended by user or in case of custom spectral characteristics of target sensor)
......
# -*- coding: utf-8 -*-
from multiprocessing import Pool
from multiprocessing import Pool, current_process
from itertools import chain
from ..options.config import GMS_config as CFG
......@@ -72,3 +72,9 @@ def imap_unordered(func, args, CPUs=None, flatten_output=False):
return list(ch)
else:
return list(results)
def is_mainprocess():
# type: () -> bool
"""Return True if the current process is the main process and False if it is a multiprocessing child process."""
return current_process().name == 'MainProcess'
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