You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I did the second example in the Quick Start section of the documentation (An agent with a behaviour). It is stated, that "this agent would go on counting forever until we press ctrl+C.".
But if I press Ctrl+C, the agent won't stop. It says "Keyboard interrupt received. Stopping SPADE..." but continues.
What I Did
import asyncio
import spade
from spade import wait_until_finished
from spade.agent import Agent
from spade.behaviour import CyclicBehaviour
class DummyAgent(Agent):
class MyBehav(CyclicBehaviour):
async def on_start(self):
print("Starting behaviour . . .")
self.counter = 0
async def run(self):
print("Counter: {}".format(self.counter))
self.counter += 1
await asyncio.sleep(1)
async def setup(self):
print("Agent starting . . .")
b = self.MyBehav()
self.add_behaviour(b)
async def main():
dummy = DummyAgent("???", "???")
await dummy.start()
print("DummyAgent started. Check its console to see the output.")
print("Wait until user interrupts with ctrl+C")
await wait_until_finished(dummy)
if __name__ == "__main__":
spade.run(main())
Output:
Agent starting . . .
DummyAgent started. Check its console to see the output.
Wait until user interrupts with ctrl+C
Starting behaviour . . .
Counter: 0
Counter: 1
Counter: 2
Counter: 3
Counter: 4
Keyboard interrupt received. Stopping SPADE...
Counter: 5
Counter: 6
Counter: 7
Counter: 8
Counter: 9
...
The text was updated successfully, but these errors were encountered:
Description
I did the second example in the Quick Start section of the documentation (An agent with a behaviour). It is stated, that "this agent would go on counting forever until we press ctrl+C.".
But if I press Ctrl+C, the agent won't stop. It says "Keyboard interrupt received. Stopping SPADE..." but continues.
What I Did
Output:
The text was updated successfully, but these errors were encountered: