Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
ActorSystem().ask doesn't receive custom message class response #6
When setting up an ActorSystem to perform an
I am using Thespian 2.5.7 as reported and installed by pip, on Python 3.5.1 as shipped in the Anaconda Python Distribution on Ubuntu 15.10 (Wily).
Please refer to the following testcase:
Thank you for the concise and well-documented example and environment descriptions.
This is actually proper behavior for the current implementation, although a bit unexpected as you noted.
Thespian has various internal messages it uses to provide functionality and manage the ActorSystem. Most of these messages are intended to remain completely internal to Thespian, although some are sent to Actors or the external system (these are documented in http://thespianpy.com/using.html#outline-container-sec-7). All the messages documented in that location can be delivered to an Actor, but only a small subset of those can be delivered to the external system (specifically: Thespian_SystemStatus, Thespian_ActorStatus, and PoisonMessage). I have updated clarifications to the documentation in this regard (96c0fb5 and 5b214fd).
The other functionality you encountered is that the
Thus, the overall sequence of events in your test above is:
Perhaps confusingly, the simpleSystemBase has slightly different behavior than the other system bases. Because it is implemented as sequential calls entirely within the context of the current process, it will return from any
In the commit I highlighted above, I also added a set of tests to validate this overall behavior. The one difference from your description above is that the version of TestMessage that subclasses object instead of ActorSystemMessage seemed to work fine for me with all bases, which is consistent with the functionality I've described here; I suspect your initial testing had some other issue that masked the functionality you expected when you used the object-derived TestMessage.
I hope this helps, and that the documentation clarifications are helpful. Please let me know if you have any suggestions for improvements in any of these areas.
I must have made a mistake when working through all of the combinations of possibilities. I've just retested with TestMessage(object) instead of TestMessage(ActorSystemMessage) and indeed it does work as expected for my environment. Must have forgotten to actually write the file for the object test run.
I will avoid subclassing ActorSystemMessage and all should be well. Thanks for the in-depth explanation!