Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion skyrl-agent/skyrl_agent/dispatcher/async_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ async def wait_all(iterable: Iterable[Coroutine], timeout: int = GENERAL_TIMEOUT
if pending:
for task in pending:
task.cancel()
raise asyncio.TimeoutError()
pending_ids = [task.get_name() for task in pending]
raise asyncio.TimeoutError(
f"Timeout waiting for {len(pending)} pending task(s) out of {len(tasks)} total. "
f"Pending task IDs: {pending_ids}"
)
Comment on lines +71 to +75

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since the tasks are created inside wait_all using asyncio.create_task(c) without explicit names, task.get_name() will return generic names like 'Task-1', 'Task-2', etc. This does not provide useful context about which coroutines actually timed out.

To make the error message much more informative, you can extract the name of the underlying coroutine using task.get_coro().__name__ with a fallback to task.get_name().

        pending_names = [
            getattr(task.get_coro(), "__name__", None) or task.get_name()
            for task in pending
        ]
        raise asyncio.TimeoutError(
            f"Timeout waiting for {len(pending)} pending task(s) out of {len(tasks)} total. "
            f"Pending tasks: {pending_names}
        )

results = []
errors = []
for task in tasks:
Expand Down