Accessing running actor system

70 views
Skip to first unread message

Andrea Musso

unread,
Mar 14, 2021, 2:46:38 PM3/14/21
to thespian.py
Hello,
This question might be very basic, but I really can't find a solution.
Let us suppose I create an actor system in one script. After the script has run, I close the script. The actor system should continue to run in the background. I would like now to open another script and have access to the actor system and the actors within it. How do I do? 

Thank you!

Kevin Quick

unread,
Mar 14, 2021, 9:45:10 PM3/14/21
to Andrea Musso, thespian.py
Hello Andrea,

The actor system does continue to run in the background if it is one of either the multiprocTCPBase or multiprocUDPBase system bases.  To access the running Thespian system in a new script, simply instantiate the ActorSystem again (e.g. the same `asys = ActorSystem(multiprocTCPBase, ...)` call you made in the original script); the creation of the ActorSystem object will connect to an existing actor system or start a new one if one is not running at that location.  

When you _do_ want the ActorSystem to shutdown, use the `.shutdown()` method on the ActorSystem object.


Regards,
  Kevin

--
You received this message because you are subscribed to the Google Groups "thespian.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thespianpy+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/thespianpy/b4eafca8-878b-442c-841a-69d3c8008644n%40googlegroups.com.


--
-KQ

Andrea Musso

unread,
Mar 15, 2021, 6:54:32 AM3/15/21
to thespian.py
Hello Kevin,

Thanks a lot for your response! Three more questions if you do not mind:

1) First, every time I call ActorSystem with systembase=multiprocTCPBase I get the following Warning: 

WARNING:root:Unable to get address info for address 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa (AddressFamily.AF_INET, SocketKind.SOCK_DGRAM, 17, 0): <class 'socket.gaierror'> [Errno 8] nodename nor servname provided, or not known
WARNING:root:Unable to get address info for address 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa (AddressFamily.AF_INET, SocketKind.SOCK_DGRAM, 17, AddressInfo.AI_PASSIVE): <class 'socket.gaierror'> [Errno 8] nodename nor servname provided, or not known

Did you have this issue before?
When I call ActorSystem with systembase=simpleSystemBase no error pops out.

2) Is it possible to access a list with all Actor adresses within an ActorSystem?

3) I would like a tip on the following general issue: I am trying to construct a database which updates itself every second with fresh information by retrieving this fresh information from an API. The database would be an Actor System which runs continuously. Every second, Actors communicate in order to fill a new entry in the database. Every now and then, I would like to be able to send some specific messages to the actors of the database. How would you suggest to do this? What I thought is:
1) I could give global names to actors, access the ActorSystem and as you explained above. That is, create a new Python File, and just declare the actor system. 
Then instantiate some actors using their global names and finally send my messages to them.
2) Create a GUI actor which is instantiated when I launch the program and then have this GUI window allowing me to communicate with the system.
These two approaches do not seem optimal. 

Do you have any suggestions?

Best regards,
Andrea Musso


Reply all
Reply to author
Forward
0 new messages