Serializing functions

2010-06-17 Thread Matteo Landi
Some weeks ago, here on the mailing list I read about picloud[1], a python library used for cloud-computing; I was impressed by its simplicity, here is an example: import cloud def square(x): ... return x * x cloud.call(square, 10) cloud.result() 100 So, I tried to figure out how to achieve the

Re: Serializing functions

2010-06-17 Thread Bruno Desthuilliers
Matteo Landi a écrit : Some weeks ago, here on the mailing list I read about picloud[1], a python library used for cloud-computing; I was impressed by its simplicity, here is an example: import cloud def square(x): ... return x * x cloud.call(square, 10) cloud.result() 100 So, I tried to

Re: Serializing functions

2010-06-17 Thread Paul Rubin
Matteo Landi landima...@gmail.com writes: If you try and pickle a function, it is not pickled as a whole, indeed, once you unpickle it, it will raise an exception telling you that the target function was not found in the current module. So I'm here, with nothing in my hands; how would you

Re: Serializing functions

2010-06-17 Thread Matteo Landi
On Thu, 2010-06-17 at 07:37 -0700, Paul Rubin wrote: Matteo Landi landima...@gmail.com writes: If you try and pickle a function, it is not pickled as a whole, indeed, once you unpickle it, it will raise an exception telling you that the target function was not found in the current module.

Re: Serializing functions

2010-06-17 Thread Paul Rubin
Matteo Landi landima...@gmail.com writes: I could be wrong, but it seems functions are not marshable objects, is it right? Hmm, you're right, you can marshal code objects, but you can't marshal a function directly. It's been a while since I've used marshal and I forgot how it works. You might

Re: Serializing functions

2010-06-17 Thread Matteo Landi
On Thu, 2010-06-17 at 07:37 -0700, Paul Rubin wrote: Matteo Landi landima...@gmail.com writes: If you try and pickle a function, it is not pickled as a whole, indeed, once you unpickle it, it will raise an exception telling you that the target function was not found in the current module.

Re: Serializing functions

2010-06-17 Thread Stephen Hansen
On 6/17/10 6:23 AM, Matteo Landi wrote: itself. If you try and pickle a function, it is not pickled as a whole, indeed, once you unpickle it, it will raise an exception telling you that the target function was not found in the current module. You can pickle functions-- and classes, instances,

Re: Serializing functions

2010-06-17 Thread Matteo Landi
On Thu, 2010-06-17 at 08:31 -0700, Stephen Hansen wrote: On 6/17/10 6:23 AM, Matteo Landi wrote: itself. If you try and pickle a function, it is not pickled as a whole, indeed, once you unpickle it, it will raise an exception telling you that the target function was not found in the current

Re: Serializing functions

2010-06-17 Thread Andreas Löscher
Am Donnerstag, den 17.06.2010, 08:18 -0700 schrieb Paul Rubin: Matteo Landi landima...@gmail.com writes: I could be wrong, but it seems functions are not marshable objects, is it right? Hmm, you're right, you can marshal code objects, but you can't marshal a function directly. It's been

Re: Serializing functions

2010-06-17 Thread Andreas Löscher
Am Donnerstag, den 17.06.2010, 18:03 +0200 schrieb Andreas Löscher: Am Donnerstag, den 17.06.2010, 08:18 -0700 schrieb Paul Rubin: Matteo Landi landima...@gmail.com writes: I could be wrong, but it seems functions are not marshable objects, is it right? Hmm, you're right, you can

Re: Serializing functions

2010-06-17 Thread Robert Kern
On 6/17/10 8:23 AM, Matteo Landi wrote: Some weeks ago, here on the mailing list I read about picloud[1], a python library used for cloud-computing; I was impressed by its simplicity, here is an example: import cloud def square(x): ... return x * x cloud.call(square, 10) cloud.result() 100

Re: Serializing functions

2010-06-17 Thread Aaron Staley
I am one of the developer's of PiCloud. To answer your question, we wrote a custom subclass of Pickler to pickle functions. As Robert pointed out, the library is LGPL, so you can see (and use) the source code. I also presented the details on a poster at PyCon 2010. You can see it here:

Re: Serializing functions

2010-06-17 Thread Chris Rebert
2010/6/17 Andreas Löscher andreas.loesc...@s2005.tu-chemnitz.de: Am Donnerstag, den 17.06.2010, 18:03 +0200 schrieb Andreas Löscher: Am Donnerstag, den 17.06.2010, 08:18 -0700 schrieb Paul Rubin: Matteo Landi landima...@gmail.com writes: I could be wrong, but it seems functions are not