Can I use @parallel for class/instance methods?
I would like to be able to evaluate some methods in parallel. For example:
class PTest(SageObject): def meth0(self,n): return n @parallel def meth1(self,n): "long and complicated method" sleep(2) return prime_pi(n) sage: L = [1000,2000,3000,4000,5000] sage: T = PTest() sage: T.meth1(L) 168 sage: r = T.meth1(L) ... TypeError: an integer is required
@parallel does work fine if I define
meth1 outside of the class, and introspection
T.meth1? indicates that the decorator has been applied to it. So I don't understand what else I should do; any ideas?