Monitoring of states of actor

18 views
Skip to first unread message

Srinivas Aditya

unread,
Aug 3, 2022, 11:49:17 AM8/3/22
to thespian.py
Hi Kevin,

I came across an old discussion here (https://groups.google.com/g/thespianpy/c/-NC4vW6ATpA/m/rNCYX70rCQAJ) about determining the state of Actors.
I am at similar point where I wish to know the states of each actor created in a ActorSytem, which shall be monitored by a master Actor and know if the actor has successfully completed, or failed to complete the task assigned. Also, master can preempt or abort the tasks in between. If possible, all this can be a state machine running on the Actor system.
Can you please confirm if any such implementation can be done using Thespian? If so, can you please guide how to monitor the states in real-time?

P.S. I'm new to Thespian and actors concept. As of now, I have made a synchronous ActorSystem which acts as different states and able to send success or fail status to the parent actor.

Thanks.
Srinivas Aditya

Kevin Quick

unread,
Aug 3, 2022, 8:40:57 PM8/3/22
to Srinivas Aditya, thespian.py
Hi Srinivas,

The discussion you referenced talks about a feature for Actors themselves to change behavior based on received messages, but that's different than being able to determine the states externally.  Fundamentally, Actors are independent and the only way to exchange information with an Actor (including determining its state) is for the Actor to send a message or receive a message.  In general, you would want to have the Actor send a message once it has completed a task, indicating whether the task was successful or not and the recipient would then update its own internal reflection of the Actor's state.

It is not possible to pre-empt the Actor: one of the reasons Actors do not need spinlocks, mutexes, or other synchronization mechanisms is because each Actor is single-threaded.  An Actor will not read a new message until the current message has been handled (i.e. the receiveMessage() exits).  Scalability in an Actor system is usually provided by running multiple instances of the Actor in parallel, but once an Actor's receiveMessage() method is entered, it will not be able to handle another message until you return from receiveMessage().

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/aae0a91d-b267-44bb-8f77-c66c5f3c2d42n%40googlegroups.com.


--
-KQ
Reply all
Reply to author
Forward
0 new messages