Replies: 2 comments
-
@jackgerrits thoughts? |
Beta Was this translation helpful? Give feedback.
0 replies
-
@jspv if you wish to cancel a user input function you should raise a CancelledError from within the callback. The cancellation token is to allow you to respond to being cancelled. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm having difficultly figuring out the right way to cleanly catch the cancellation from the token when leveraged in the
input_func
parameter to UserProxyAgent. I want to catch the expected CancelledError, but I'm seeing a pedantic exception which appears to be coming from _user_proxy_agent.py which I can't seem to catch or handle more gracefully. Below is a minimal example:I also tried reducing it to just down to UserProxyAgent, no RoundRobin and while here I can catch the exception, it exhibits an odd behavior that I have to press "Enter" to complete the process, even though it is cancelled.
Letting the timer cancel the task:
Completing the task via input:
$python test.py Enter your response: hello Your name is hello Agent status is FINISHED $
No enter needed. Not sure if this second issue is related, it seems to have a process sitting out there waiting. I can hit ctrl-c instead of enter and I see that something is keeping cancellable_user_agent active even after the task has been cancelled.
Any help appreciated.
Beta Was this translation helpful? Give feedback.
All reactions