Closed mojtabatorabii closed 2 years ago
You did not specify a system base in the ActorSystem()
call, so the default of simpleSystemBase
was used. This base runs operations synchronously and this affects the delivery of timeouts (as described https://thespianpy.com/doc/using.html#hH-924dc0fe-c15b-491e-a6d1-8b88683d4c0d). I've added additional information for the ask() (https://thespianpy.com/doc/using.html#hH-8e52624b-cda1-4218-bc9f-693cf06b0758) and listen() calls to clarify this.
I would recommend using a different system base (e.g. the multiprocTCPBase
) if you need effective timeouts.
Hi thanks, Can you give me a working code example ? Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows
From: Kevin @.> Sent: Tuesday, January 18, 2022 7:41 PM To: @.> Cc: Mojtaba @.>; @.> Subject: Re: [kquick/Thespian] timeout not works in ActorSystem().ask() function (Issue #83)
You did not specify a system base in the ActorSystem() call, so the default of simpleSystemBase was used. This base runs operations synchronously and this affects the delivery of timeouts (as described https://thespianpy.com/doc/using.html#hH-924dc0fe-c15b-491e-a6d1-8b88683d4c0d). I've added additional information for the ask() (https://thespianpy.com/doc/using.html#hH-8e52624b-cda1-4218-bc9f-693cf06b0758) and listen() calls to clarify this.
I would recommend using a different system base (e.g. the multiprocTCPBase) if you need effective timeouts.
— Reply to this email directly, view it on GitHubhttps://github.com/kquick/Thespian/issues/83#issuecomment-1015566867, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALPMRXZFLXFGEFDZHEG32SLUWWGMLANCNFSM5MGKYF7Q. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>
If you change the first __main__
line to the following it should produce the behavior you are expecting:
hello_actor = ActorSystem(systemBase='multiprocTCPBase').createActor(actorClass=Hello)
As a note, this will leave the actor system running, so you may wait to also add a transientUnique = True
argument as well and/or specify ActorSystem().shutdown()
at the end of your script. See https://thespianpy.com/doc/using.html#hH-f71b7bfa-c57b-4716-a2c7-ad83a2ed3582 for more details.
Thanks a lot !
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows
From: Kevin Quick @.> Sent: Wednesday, January 19, 2022 12:07:19 AM To: kquick/Thespian @.> Cc: Mojtaba Torabi @.>; Author @.> Subject: Re: [kquick/Thespian] timeout not works in ActorSystem().ask() function (Issue #83)
If you change the first main line to the following it should produce the behavior you are expecting:
hello_actor = ActorSystem(systemBase='multiprocTCPBase').createActor(actorClass=Hello)
As a note, this will leave the actor system running, so you may wait to also add a transientUnique = True argument as well and/or specify ActorSystem().shutdown() at the end of your script. See https://thespianpy.com/doc/using.html#hH-f71b7bfa-c57b-4716-a2c7-ad83a2ed3582 for more details.
— Reply to this email directly, view it on GitHubhttps://github.com/kquick/Thespian/issues/83#issuecomment-1015813950, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALPMRX7DIY6GAPREUTOLC6LUWXFP7ANCNFSM5MGKYF7Q. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>
from thespian.actors import * from time import sleep
class Hello(Actor): def receiveMessage(self, message, sender): sleep(0.5) self.send(sender, f'Hi, {message}!')
if name == 'main':
hello word example
based on your documentation in the above code "response" must be None !!