I am trying to run a very simple example using Thespian Actors in witch one actor lauches another.
from thespian.actors import *
import logging
logging.basicConfig(level=logging.DEBUG)
class serviceA(Actor):
def __init__(self):
logging.info(f"{str(self.__class__)} loaded")
def receiveMessage(self, message, sender):
logging.info(f"message received: {message}")
if (message == 'create another'):
logging.info("creating another...")
newActor = self.createActor(serviceB)
class serviceB(Actor):
def __init__(self):
logging.info(f"{str(self.__class__)} loaded")
def run():
ActorSystem()
A = ActorSystem().createActor(serviceA)
ActorSystem().tell(A,'create another')
input()
ActorSystem().shutdown()
if __name__ == "__main__":
run()
When I start with an ActorSystem("simpleSystemBase") it works well, and I get this:
2023-02-23 15:07:39,913 INFO => <class '__main__.serviceA'> loaded [teste_nestedActors.py:9]
2023-02-23 15:07:39,913 INFO => message received: create another [teste_nestedActors.py:11]
2023-02-23 15:07:39,913 INFO => creating another... [teste_nestedActors.py:13]
2023-02-23 15:07:39,913 INFO => <class '__main__.serviceB'> loaded [teste_nestedActors.py:18]
However, if I use any other systemBase, it doesn't work.
For ActorSystem("multiprocQueueBase") I get:
INFO:root:++++ Actor System gen (3, 10) started, admin @ ActorAddr-Q.ThespianQ
DEBUG:root:Thespian source: C:\Users\tomaz\AppData\Local\Programs\Python\Python310\lib\site-packages\thespian\__init__.py
and for TCP or UDP I get this error:
raise InvalidActorAddress(self.adminAddr, thespian.actors.InvalidActorAddress: ActorAddr-(T|:1900) is not a valid or useable ActorSystem Admin
Any tips?
I wanted an Actor to create another using multiprocessing systemBase's, but I only managed to do so without parallelism, using the simpleSystemBase.
Thanks, André.