rlightning.utils.ray.task_submitter¶
Task submission utilities for Ray actors.
This module provides the TaskSubmitter class for managing task submission to Ray actors with pending task limits.
- class rlightning.utils.ray.task_submitter.TaskSubmitter(max_pending_tasks_each_worker: int = 1)[source]¶
Bases:
objectTask submitter for local and remote Ray actor methods.
Manages task submission to either local class functions or remote Ray actors, ensuring that the number of pending tasks does not exceed a specified limit.
This class is thread-safe for concurrent task submissions.
- max_pending_tasks¶
Maximum number of pending tasks allowed per actor.
- worker_ref_to_pending_tasks¶
Mapping from actor handles to pending task refs.
- submit(method: Callable, *args: Any, _block: bool = False, **kwargs: Any)[source]¶
Submit a task to a local method or Ray actor.
This method is thread-safe for concurrent submissions.
- Parameters:
method – The method to be called (local or ray.actor.ActorMethod).
*args – Positional arguments for the method.
_block – If True, block until the remote task completes and return the actual result instead of a future.
**kwargs – Keyword arguments for the method.
- Returns:
the actual result. For remote methods with _block=False: a ray.ObjectRef.
- Return type:
For local methods or when _block=True
- Raises:
ValueError – If _block is not a boolean value.