MCPcopy
hub / github.com/ray-project/ray / TaskPoolStrategy

Class TaskPoolStrategy

python/ray/data/_internal/compute.py:32–61  ·  view source on GitHub ↗

Specify the task-based compute strategy for a Dataset transform. TaskPoolStrategy executes dataset transformations using Ray tasks that are scheduled through a pool. Provide ``size`` to cap the number of concurrent tasks; leave it unset to allow Ray Data to scale the task count auto

Source from the content-addressed store, hash-verified

30
31@PublicAPI
32class TaskPoolStrategy(ComputeStrategy):
33 """Specify the task-based compute strategy for a Dataset transform.
34
35 TaskPoolStrategy executes dataset transformations using Ray tasks that are
36 scheduled through a pool. Provide ``size`` to cap the number of concurrent
37 tasks; leave it unset to allow Ray Data to scale the task count
38 automatically.
39 """
40
41 def __init__(
42 self,
43 size: Optional[int] = None,
44 ):
45 """Construct TaskPoolStrategy for a Dataset transform.
46
47 Args:
48 size: Specify the maximum size of the task pool.
49 """
50
51 if size is not None and size < 1:
52 raise ValueError("`size` must be >= 1", size)
53 self.size = size
54
55 def __eq__(self, other: Any) -> bool:
56 return (isinstance(other, TaskPoolStrategy) and self.size == other.size) or (
57 other == "tasks" and self.size is None
58 )
59
60 def __repr__(self) -> str:
61 return f"TaskPoolStrategy(size={self.size})"
62
63
64@PublicAPI

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…