Direct access to an actor's internals without messages

37 views
Skip to first unread message

馬杰鴻

unread,
Jul 7, 2015, 5:25:20 PM7/7/15
to python...@googlegroups.com
Hello,

I've put in place an example of an access of an actor's internal functions without messages, basically because an actor simply is an object.

You can check this working example here: http://pastebin.com/0uwjaxbt

Basically, I simply wanted to create an object which would be considered an actor by pulsar, which I could simply spawn. Effectively having some functions internal to the actor, acting only on it's content.

But, right now, it seems that I must either add an object inside a previously created actor, or modify an actor, after creation, in order for it to store things I plan it to keep and work on. For such a case, given any function, to apply it to an actor's internal value, I need to send the whole function to the actor in a weird manner: `a.send(b, 'run', function, b.value1, b.value2)` for example.

Am I doing shit in my example? Perhaps what I would like to achieve is not possible…

Thank you for your time, at least to read my message :)

Jiehong


lsbardel

unread,
Jul 8, 2015, 3:40:59 AM7/8/15
to python...@googlegroups.com, ma.ji...@gmail.com
Hi, 

Basically, I simply wanted to create an object which would be considered an actor by pulsar, which I could simply spawn. Effectively having some functions internal to the actor, acting only on it's content.

But, right now, it seems that I must either add an object inside a previously created actor, or modify an actor, after creation, in order for it to store things I plan it to keep and work on. For such a case, given any function, to apply it to an actor's internal value, I need to send the whole function to the actor in a weird manner: `a.send(b, 'run', function, b.value1, b.value2)` for example.

Pulsar is a low level actor framework which you can use to build parallel applications.
The app module contains several of these higher level applications, the most common ones.

Building a framework that does what you are asking is not too difficult and I've just put together a small implementation which may provide some guidance.


All you need to do is to subclass the ``Remote`` class and add method prefixed with ``remote_``. The mini-framework allows one to implement remote methods without directly using the ``send`` primitive.

Regards,
Reply all
Reply to author
Forward
0 new messages