From 80435f98975c19b4160faae6b74d3c878d43f943 Mon Sep 17 00:00:00 2001 From: thouska Date: Mon, 31 May 2021 14:35:12 +0200 Subject: [PATCH] Fix for #266 pathos multiprocessing imap was resulting in broke spotpy database. Switching to map solces the issue --- spotpy/examples/spot_setup_hymod_exe.py | 1 - spotpy/examples/tutorial_parallel_computing_hymod.py | 4 ++-- spotpy/parallel/mproc.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/spotpy/examples/spot_setup_hymod_exe.py b/spotpy/examples/spot_setup_hymod_exe.py index ef55bc6e..047c57a2 100644 --- a/spotpy/examples/spot_setup_hymod_exe.py +++ b/spotpy/examples/spot_setup_hymod_exe.py @@ -11,7 +11,6 @@ import numpy as np import spotpy import os -import multiprocessing as mp from distutils.dir_util import copy_tree, remove_tree #from shutil import rmtree import sys diff --git a/spotpy/examples/tutorial_parallel_computing_hymod.py b/spotpy/examples/tutorial_parallel_computing_hymod.py index 5fe05ba7..553cd3bb 100644 --- a/spotpy/examples/tutorial_parallel_computing_hymod.py +++ b/spotpy/examples/tutorial_parallel_computing_hymod.py @@ -47,7 +47,7 @@ sampler.sample(rep) # Load results from file - #results = spotpy.analyser.load_csv_results('Parallel_hymod') - + results = spotpy.analyser.load_csv_results('Parallel_hymod') + print(len(results)) # Plot best model run #spotpy.analyser.plot_bestmodelrun(results,spot_setup.evaluation()) \ No newline at end of file diff --git a/spotpy/parallel/mproc.py b/spotpy/parallel/mproc.py index 7594e9df..21094b59 100644 --- a/spotpy/parallel/mproc.py +++ b/spotpy/parallel/mproc.py @@ -50,6 +50,6 @@ def f(self, job): return data def __call__(self, jobs): - results = self.pool.imap(self.f, jobs) + results = self.pool.map(self.f, jobs) for i in results: yield i