nemo_rl.models.generation.sglang.utils#
Module Contents#
Classes#
A background event loop thread for running async operations in Ray actors. |
API#
- class nemo_rl.models.generation.sglang.utils.AsyncLoopThread#
A background event loop thread for running async operations in Ray actors.
This class creates a dedicated thread with its own event loop, allowing synchronous Ray actor methods to execute async coroutines without blocking the main actor thread. This is necessary because run_coroutine_threadsafe requires the event loop to be in a different thread.
Initialization
- _start_loop()#
Run the event loop in the background thread.
- run(coro)#
Schedule a coroutine onto the loop and block until it’s done.
- Parameters:
coro – The coroutine to execute
- Returns:
The result of the coroutine
- shutdown()#
Shutdown the event loop and wait for the thread to finish.