We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 226b37d commit b5d33cbCopy full SHA for b5d33cb
python/samples/core_grpc_worker_runtime/run_host.py
@@ -1,12 +1,24 @@
1
import asyncio
2
+import os
3
4
from autogen_ext.runtimes.grpc import GrpcWorkerAgentRuntimeHost
5
6
7
async def main() -> None:
8
service = GrpcWorkerAgentRuntimeHost(address="localhost:50051")
9
service.start()
- await service.stop_when_signal()
10
+
11
+ try:
12
+ # Wait for the service to stop
13
+ if os.system() == "Windows":
14
+ # On Windows, the signal is not available, so we wait for a new event
15
+ await asyncio.Event().wait()
16
+ else:
17
+ await service.stop_when_signal()
18
+ except KeyboardInterrupt:
19
+ print("Stopping service...")
20
+ finally:
21
+ await service.stop()
22
23
24
if __name__ == "__main__":
0 commit comments