jodal / pykka

🌀 Pykka makes it easier to build concurrent Python applications.
https://pykka.readthedocs.io
Apache License 2.0
1.21k stars 108 forks source link

Support multiple actor systems #18

Open jodal opened 11 years ago

jodal commented 11 years ago

I want to replace the global ActorRegistry with an "actor system" concept. You should be able to run multiple actor systems in the same process at the same time. Any actor lookups, like you today do using ActorRegistry, should only return results from the same actor system. Two actors in two different actor systems should under normal API usage not be able to get references to each other. In other words, an actor system should be isolated from other actor systems.

The use case here is mostly to get rid of the global state maintained by ActorRegistry, not to make it possible to have multiple actor systems in the same process. That's just a convenient side effect. Isolated actor systems will also be of great help in tests, and should make parallel test running possible since tests no longer share any global state.

Today's ActorRegistry API can maybe be kept around as a convenience wrapper around a default actor system.

fatuhoku commented 11 years ago

I think an actor system concept would also resolve #30 (cyclic initialisation).

  1. Register actors with an actor system (a bag)
  2. Once all participating actors have been initialised (i.e., they're ready to receive messages; even before their on_start() handlers have been called), the actor system would then call each actor's on_start() to execute once-off behaviour
  3. Be happy