Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ def _derive_target_scaling_config(
reason="pool exceeding max size",
)

# To prevent unexpected downscaling from the initial size, short-circuit if
# the operator hasn't received any inputs.
if op.metrics.num_inputs_received == 0:
return ActorPoolScalingRequest.no_op(reason="no inputs received")

# Determine whether to scale up based on the actor pool utilization.
util = self._compute_utilization(actor_pool)

Expand Down
9 changes: 8 additions & 1 deletion python/ray/data/tests/test_autoscaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_actor_pool_scaling():
_inputs_complete=False,
input_dependencies=[MagicMock()],
internal_input_queue_num_blocks=MagicMock(return_value=1),
metrics=MagicMock(average_num_inputs_per_task=1),
metrics=MagicMock(average_num_inputs_per_task=1, num_inputs_received=1),
)
op_state = OpState(
op, inqueues=[MagicMock(__len__=MagicMock(return_value=10), num_blocks=10)]
Expand Down Expand Up @@ -217,6 +217,13 @@ def assert_autoscaling_action(
expected_reason="exceeded resource limits",
)

# Should no-op because the op has not received any inputs.
with patch(op.metrics, "num_inputs_received", 0, is_method=False):
assert_autoscaling_action(
delta=0,
expected_reason="no inputs received",
)


@pytest.fixture
def autoscaler_max_upscaling_delta_setup():
Expand Down