2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-26 03:38:25 +08:00

aqctl_corelog: fix asyncio loop management

This commit is contained in:
Sebastien Bourdeauducq 2023-01-12 10:52:26 +08:00
parent 628b671433
commit f8d93813e9

View File

@ -96,14 +96,15 @@ def main():
signal_handler.setup() signal_handler.setup()
try: try:
get_logs_task = asyncio.ensure_future( get_logs_task = asyncio.ensure_future(
get_logs_sim(args.core_addr) if args.simulation else get_logs(args.core_addr)) get_logs_sim(args.core_addr) if args.simulation else get_logs(args.core_addr),
loop=loop)
try: try:
server = Server({"corelog": PingTarget()}, None, True) server = Server({"corelog": PingTarget()}, None, True)
loop.run_until_complete(server.start(common_args.bind_address_from_args(args), args.port)) loop.run_until_complete(server.start(common_args.bind_address_from_args(args), args.port))
try: try:
_, pending = loop.run_until_complete(asyncio.wait( _, pending = loop.run_until_complete(asyncio.wait(
[signal_handler.wait_terminate(), [loop.create_task(signal_handler.wait_terminate()),
server.wait_terminate(), loop.create_task(server.wait_terminate()),
get_logs_task], get_logs_task],
return_when=asyncio.FIRST_COMPLETED)) return_when=asyncio.FIRST_COMPLETED))
for task in pending: for task in pending: