[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [modeller_usage] Parallel job (part 2)



Francesco Musiani wrote:
Ok, I modified my script as in the example.
...
class mymodel(allhmodel):
	def special_restraints(self, aln):
		s1 = selection(self.chains['A'])
		s2 = selection(self.chains['B'])
		self.restraints.symmetry.append(symmetry(s1, s2, 1.0))
	def user_after_single_model(self):
		self.restraints.symmetry.report(1.0)
...
i obtained this error:
...
modeller.parallel.communicator.RemoteError: AttributeError: 'module' object has no attribute 'mymodel' from <Slave on localhost>

The parallel module uses Python's pickle module to send classes to slaves, so is subject to the same restrictions as regular pickle: see http://docs.python.org/lib/node317.html

In particular, this means that you can't define a subclass in your main script (because the slaves can't import it) - move your 'mymodel' class to a separate file, e.g. mymodel.py, and then import it into your main script ('from mymodel import mymodel').

See, for an example, examples/python/parallel-task.py

	Ben Webb, Modeller Caretaker
--
             http://www.salilab.org/modeller/
Modeller mail list: http://salilab.org/mailman/listinfo/modeller_usage