class ray.data.ActorPoolStrategy(legacy_min_size: Optional[int] = None, legacy_max_size: Optional[int] = None, *, size: Optional[int] = None, min_size: Optional[int] = None, max_size: Optional[int] = None, max_tasks_in_flight_per_actor: Optional[int] = None)[source]#

Bases: ray.data._internal.compute.ComputeStrategy

Specify the compute strategy for a Dataset transform.

ActorPoolStrategy specifies that an autoscaling pool of actors should be used for a given Dataset transform. This is useful for stateful setup of callable classes.

For a fixed-sized pool of size n, specify compute=ActorPoolStrategy(size=n). To autoscale from m to n actors, specify ActorPoolStrategy(min_size=m, max_size=n).

To increase opportunities for pipelining task dependency prefetching with computation and avoiding actor startup delays, set max_tasks_in_flight_per_actor to 2 or greater; to try to decrease the delay due to queueing of tasks on the worker actors, set max_tasks_in_flight_per_actor to 1.

PublicAPI: This API is stable across Ray releases.


__init__([legacy_min_size, legacy_max_size, ...])

Construct ActorPoolStrategy for a Dataset transform.