A daemon or service using actors

22 views
Skip to first unread message

dendron2000

unread,
Sep 14, 2020, 4:51:06 PM9/14/20
to thespian.py
Hi, sorry if my question sounds a bit naive but...

Is there a way to make an Actor persistent? Like for example create a daemon/service which will keep running in the background and reacting to messages? It’d be nice if that could be done by using thespian Director.

Currently once the top level actor has finished processing its messages the ActorSystem simply quits. There seems to be no way to “daemonize” an Actor.

While it is commonly known how to implement a daemon using a more conventional programming model, I have no idea how to do that in an “actor-friendly” way. Does anyone have experience with that?

Kevin Quick

unread,
Sep 15, 2020, 11:39:23 AM9/15/20
to dendron2000, thespian.py
Hi,

Yes, actually Thespian actors are persistent by default if you use one of the multiproc bases and you don't specify the transient flag.  This includes actor systems started by the director.  The Director even has modes where it can setup a system service that starts Thespian at boot time to run as a boot-started daemon on the system.

If you are using the simpleSystemBase, then the actor system will quit once the application quits.  If you are seeing the ActorSystem exiting, check to make sure you are using one of the multiproc system bases and that you don't ever call `ActorSystem().shutdown()`.

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/395deabf-4b82-4cc4-913a-786b648f672fn%40googlegroups.com.


--
-KQ

dendron2000

unread,
Oct 3, 2020, 10:12:30 AM10/3/20
to thespian.py
Hi Kevin, sorry it took this long for me to answer. Thank you very much for your explanation. Indeed I'm currently only using simpleSystemBase for debug purposes. It seems it's time to switch to the multiproc one.

вторник, 15 сентября 2020 г. в 16:39:23 UTC+1, kq1q...@gmail.com:
Reply all
Reply to author
Forward
0 new messages