From d695f4d78dfd4e0bc2f22f85b15f521f7639150e Mon Sep 17 00:00:00 2001 From: bd Date: Sun, 13 Jul 2025 11:53:02 -0600 Subject: Attempt 1 to obtain currently executing futures --- aergia | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/aergia b/aergia index a698152..2474351 100755 --- a/aergia +++ b/aergia @@ -246,11 +246,17 @@ class Aergia(object): '''Given an asyncio event loop, returns the list of idle task frames. A task is considered 'idle' if it is not currently executing.''' curr_task = asyncio.current_task(loop) - return [ - task.get_coro().cr_frame - for task in asyncio.all_tasks(loop) - if task is not curr_task - ] + if curr_task: + curr_task.print_stack() + idle = [] + for task in asyncio.all_tasks(loop): + if task is not curr_task: + # according to docs, the frames are always ordered from oldest + # to newest + # task.print_stack() + # https://stackoverflow.com/questions/73657828/how-to-tell-where-an-asyncio-task-is-waiting + idle.append(task.get_stack()[0]) + return idle @staticmethod def sum_sample(sample): -- cgit v1.2.3