On Mon, Apr 13, 2009 at 11:49 PM, arschles <
arsc...@gmail.com> wrote:
>
>> Pysage already makes this pretty easy. Look at:
>>
>>
http://code.google.com/p/pysage/wiki/Grouping
>
> I looked at that documentation earlier. On the line:
>
> <code>
> # queues a message to the main group
> mgr.queue_message_to_group(mgr.PYSAGE_MAIN_GROUP, SomeWorkDoneMessage
> ())
> </code>
>
> do the actors in the main group need to call tick in order to handle
> SomeWorkDoneMessage?
Yes. The actormanager residing in the main group will need to call
"tick" to receive and process that message. This message is sent from
the "worker_group" process.
>
>> Does that help? Let me know because I would like to provide more
>> documentation around this area.
>
> yes, that helps a lot. maybe I could write some docs, as it would
> definitely help my understanding. here's how I understand the message
> sending infrastructure so far:
>
> * an actor is the fundamental unit of concurrency
True in pure actor's model. In pysage, (without talking about
network), each process group is independent and therefore concurrent
with other groups. Many actors may reside in the same group, actors
in the same group are essentially synchronous.
> * one or more actors reside inside of processes, which are called
> groups. by default, the main group is the python script that starts
> the whole system (ie: the "main" function)
> * each group has a single ActorMgr class, which any group-local actor
> can use to receive messages, create new actors, send messages, receive
> messages, etc...
> * any single actor can communicate with a group on the same physical
> machine (via an IPC mechanism) or with a group across a network (via
> RakNet UDP, more transport protocols coming).
Right now, only the main group can communicate with all worker groups.
A worker group can communicate with the main group only. It's a tree
one level deep with the main group as the root, instead of a maximal
graph. Although, this could be enhanced in the future such that
worker groups can communicate with each other directly.
> * It is the client's responsibility to know whether a message needs to
> be sent over the network or over IPC
Yes. You need to be aware whether you are working with a group or
with a network. Although, this can be abstracted away later.
> * It is every group's responsibility to explicitly receive messages.
> each group does so with a call to the ActorMgr.tick method.
Yes. Each "tick" call polls for IPC as well as network packets.
Although, like we talked about, the actors update should be broken out
from tick, or passed in as a parameter.
>
> Is this correct? If so, does it comprehensively describe the message
> passing infrastructure in pysage? I'm definitely willing to write docs
> on this subject.
Yeap, mostly correct. I added some clarifications to some points.
Aaron, it would be a great help if you could contribute to the
documentation. I'm currently using google code wiki as the
documentation tool. I'm not sure if it's the best approach, but we
may have to work with it. Any thoughts on that?