From c4e802815a6987a6ca13722056e286b955cd58a0 Mon Sep 17 00:00:00 2001 From: SCM Date: Mon, 15 May 2023 14:44:59 +0100 Subject: [PATCH] bug in scoring/dope_score reduce class --- src/molearn/scoring/dope_score.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/molearn/scoring/dope_score.py b/src/molearn/scoring/dope_score.py index c7a665f..b746a19 100644 --- a/src/molearn/scoring/dope_score.py +++ b/src/molearn/scoring/dope_score.py @@ -148,7 +148,7 @@ class Parallel_DOPE_Score(): results = np.array([r.get() for r in results]) ''' - def __init__(self, mol, processes=-1, **kwargs): + def __init__(self, mol, processes=-1, context = 'spawn', **kwargs): ''' :param biobox.Molecule mol: biobox molecule containing one example frame of the protein to be analysed. This will be passed to DOPE_Score class instances in each thread. :param int processes: (default: -1) Number of processes argument to pass to multiprocessing.pool. This controls the number of threads created. @@ -163,7 +163,7 @@ def __init__(self, mol, processes=-1, **kwargs): self.processes = processes self.mol = deepcopy(mol) score = DOPE_Score - ctx = get_context('spawn') + ctx = get_context(context) self.pool = ctx.Pool(processes=processes, initializer=set_global_score, initargs=(score, dict(mol=mol)), **kwargs, @@ -171,7 +171,7 @@ def __init__(self, mol, processes=-1, **kwargs): self.process_function = process_dope def __reduce__(self): - return (self.__class__, (self.mol, processes=self.processes)) + return (self.__class__, (self.mol, self.processes)) def get_score(self, coords, **kwargs): '''