pydvl.parallel.backends.ray
¶
RayParallelBackend
¶
RayParallelBackend(config: ParallelConfig | None = None)
Bases: ParallelBackend
Class used to wrap ray to make it transparent to algorithms.
Example
Source code in src/pydvl/parallel/backends/ray.py
executor
classmethod
¶
executor(
max_workers: int | None = None,
*,
config: ParallelConfig | None = None,
cancel_futures: CancellationPolicy | bool = CancellationPolicy.PENDING
) -> Executor
Returns a futures executor for the parallel backend.
Example
PARAMETER | DESCRIPTION |
---|---|
max_workers |
Maximum number of parallel workers.
TYPE:
|
config |
(DEPRECATED) Object configuring parallel computation, with cluster address, number of cpus, etc.
TYPE:
|
cancel_futures |
Policy to use when cancelling futures after exiting an Executor.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Executor
|
Instance of RayExecutor. |
Source code in src/pydvl/parallel/backends/ray.py
wrap
¶
Wraps a function as a ray remote.
PARAMETER | DESCRIPTION |
---|---|
fun |
the function to wrap
TYPE:
|
kwargs |
keyword arguments to pass to @ray.remote
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
Callable
|
The |