1

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é.

  • Guys, Apparently I solved this issue using the pykka actor framework instead of TheSpian. If anyone has luck with Thespian, please let me know. – André Carvalho Feb 24 '23 at 19:14

1 Answers1

2

if you get this "is not a valid or useable ActorSystem Admin" error that means it is not able to start the "admin" actor at well-known port 1900. This "admin" actor coordinates the activities of the actors on this system, and also handle connections between local actors and actors on other systems.

You might try something like $ netstat -vanep | grep 1900 to see if you already have something else running on that port. If you do, you can either stop that other service, or direct Thespian to use a different admin port (see the "Admin Port" setting at https://thespianpy.com/doc/using.html#hH-9d33a877-b4f0-4012-9510-442d81b0837c.

There's not enough output from your multiprocQueueBase to determine what the problem was there; perhaps a previous ActorSystem of a different base was already started in that process, but that's purely a guess.

If you return to using Thespian, I'm happy to help resolve issues either here or via the Thespian issues reporting (sorry for the delay, I was travelling out of the country).

-Kevin [Thespian author]

KQ.
  • 922
  • 4
  • 8
  • do you have any kind of "verbose" mode available when starting an actor system, to help troubleshoot? I'm trying to run `Thespian` on macOS 12.6.3 / Py 3.9 and getting this same error: `thespian.actors.InvalidActorAddress: ActorAddr-(T|:1900) is not a valid ActorSystem admin` even though there was not 1900/tcp port being used by another app. However, even after that exception gets raised, the 1900/tcp port is open and I can run the `Hello World` example from the "Quick Start" in the docs. – Paco Jul 22 '23 at 18:05
  • 1
    Hi @paco, There is an internal log maintained by Thespian that is normally very short, but which can be extended and made more detailed: see Section 13.3 at https://thespianpy.com/doc/using.html#hH-ce55494c-dd7a-4258-a1e8-b090c3bbb1e6, and please feel free to engage on the github project issues tracker in regards to the above error. – KQ. Jul 24 '23 at 20:49