Hi Michael,
The problem occurs because child processes return their results using
pickle, and the ordinary rdkit molecule object when is being pickled it
looses information.
A solution that I use is to convert the molecule objects to PropertyMol
objects, which retain their properties.
Best,
Christos
Christos Kannas
Researcher
Ph.D Student
Mob (UK): +44 (0) 7447700937
Mob (Cyprus): +357 99530608
[image: View Christos Kannas's profile on LinkedIn]
<http://cy.linkedin.com/in/christoskannas>
On 2 February 2015 at 09:03, Reutlinger, Michael <
[email protected]> wrote:
> Hi all,
>
> I am currently trying to parallelize part of a script using RDKIT and
> concurrent.futures. The function that is executed in parallel returns
> processed molecules as RDKIT Mol objects.
>
> Without parallelization everything is fine and the Mol objects keep all
> the properties that they had before the processing. When using
> concurrent.futures, the returned molecules lose all properties and seem to
> be created from scratch maybe with unknown side-effects.
>
> I am wondering if anyone experienced the same issue and knows how to
> circumvent this. I attached a ipython notebook with a small script
> demonstrating the issue.
>
> Best,
> Michael
>
>
>
>
> Example Code:
>
> from concurrent import futures
> from rdkit import Chem
> from rdkit.Chem import AllChem
> from rdkit.Chem.Draw import IPythonConsole
>
> def process(mol):
> if not "Name" in mol.GetPropNames():
> print "Processing: Name missing"
> mol.SetProp("Processed","True")
> return mol
>
> mol = Chem.MolFromSmiles("N[C@@H](C)C(=O)O")
> mol.SetProp("Name","Alanine")
>
> with futures.ProcessPoolExecutor(max_workers=1) as pool:
> future = pool.submit(process, mol)
> molOut = future.result()
> if "Name" not in molOut.GetPropNames():
> print "Result: Name missing"
> if "Processed" not in molOut.GetPropNames():
> print "Result: Processed missing"
>
>
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is
> your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Rdkit-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss