summaryrefslogtreecommitdiff
path: root/aergia
diff options
context:
space:
mode:
Diffstat (limited to 'aergia')
-rwxr-xr-xaergia16
1 files 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):