pysage

lightweight high-level message passing library supporting actor based concurrency
Download

pysage Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Price:
  • FREE
  • Publisher Name:
  • John S. Yang
  • Publisher web site:
  • http://code.google.com/u/bigjhnny/

pysage Tags


pysage Description

lightweight high-level message passing library supporting actor based concurrency pysage is a lightweight high-level message passing Python library supporting actor based concurrency.It also extends the "actor model" to support actor partitioning/grouping to further scalability. pysage has a simple high-level interface. Messages are serialized and sent lightweight using pipes or domain sockets across local "groups". In the case of network messages, UDP is used.* simple pythonic API* efficient message propagation within group, across group, across network* network messages can optionally be configured to be reliable and/or ordered using UDP* grouping - actors can be partitioned into groups that are run in separate os processes* process-local singleton manager - actor registration, discovery, message propagation* publisher/subscriber pattern built-in pysage strives to stay thin and lightweight.Installationpysage can be installed via setuptools:easy_install pysageUsageHere, we have a simple actor that receives a "take damage" message in a 30 ticks/sec game loop.import timefrom pysage import Actor, ActorManager, Messagemgr = ActorManager.get_singleton()class BombMessage(Message): properties = packet_type = 101class Player(Actor): subscriptions = def handle_BombMessage(self, msg): print 'I took %s damage from the bomb' % msg.get_property('damage')mgr.register_actor(Player(), 'player1')mgr.queue_message(BombMessage(damage=10))while True: processed = mgr.tick() time.sleep(.03)pysage allows you to use this same simple API, for messaging across processes and networks.pysage does not confine you to the constraints of the "actor model". For example, the "grouping" concept allows many actors to reside in the same process. This allows you to avoid spawning too many os processes and reduce IPC overhead.Further, actors in the same group are local to each other, so they can have access to each other. It's kind of like a: "what happens in the group, stays in the group" concept. Although, using messages are encouraged instead of straight calls for most situations, even in the same pysage group. Requirements: · Python


pysage Related Software