summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-07-13 11:53:02 -0600
committerbd <bdunahu@operationnull.com>2025-07-13 11:53:02 -0600
commitd695f4d78dfd4e0bc2f22f85b15f521f7639150e (patch)
treebfeb5ac9e23e4b2345f3e319cc8b5cc6c3ecaa3a
parentf0a3659468fe1c2461b048d49e292ef7d61fc76a (diff)
Attempt 1 to obtain currently executing futures
-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):