Skip to content

Commit

Permalink
Remove unused MAX_COUNT update policy
Browse files Browse the repository at this point in the history
Remove unused MAX_COUNT update policy, that was used only by MaxCount

Signed-off-by: Luca Carrogu <carrogu@amazon.com>
  • Loading branch information
lukeseawalker committed Jan 8, 2024
1 parent 901a690 commit 03cf55b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 41 deletions.
11 changes: 0 additions & 11 deletions cli/src/pcluster/config/update_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,17 +507,6 @@ def condition_checker_login_nodes_stop_policy(_, patch):
<= patch.target_config["Scheduling"]["AwsBatchQueues"][0]["ComputeResources"][0]["MaxvCpus"],
)

# Checks resize of max_count
UpdatePolicy.MAX_COUNT = UpdatePolicy(
name="MAX_COUNT",
level=1,
fail_reason=lambda change, patch: "Shrinking a queue requires the compute fleet to be stopped first",
action_needed=UpdatePolicy.ACTIONS_NEEDED["pcluster_stop"],
condition_checker=lambda change, patch: not patch.cluster.has_running_capacity()
or (int(change.new_value) if change.new_value is not None else DEFAULT_MAX_COUNT)
>= (int(change.old_value) if change.old_value is not None else DEFAULT_MAX_COUNT),
)

# Update supported only with all compute nodes down or with replacement policy set different from COMPUTE_FLEET_STOP
UpdatePolicy.QUEUE_UPDATE_STRATEGY = UpdatePolicy(
name="QUEUE_UPDATE_STRATEGY",
Expand Down
30 changes: 0 additions & 30 deletions cli/tests/pcluster/config/test_update_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,6 @@
from tests.pcluster.test_utils import dummy_cluster


@pytest.mark.parametrize(
"is_fleet_stopped, old_max, new_max, expected_result",
[
pytest.param(True, 10, 9, True, id="stopped fleet and new_max < old_max"),
pytest.param(False, "10", "9", False, id="running fleet and new_max < old_max"),
pytest.param(True, 10, 11, True, id="stopped fleet new_max > old_max"),
pytest.param(False, 10, 9, False, id="running fleet and new_max < old_max"),
pytest.param(False, 10, 11, True, id="running fleet and new_max > old_max"),
pytest.param(False, None, 0, False, id="running fleet and new_max < DEFAULT_MAX_COUNT"),
pytest.param(False, None, 11, True, id="running fleet and new_max > DEFAULT_MAX_COUNT"),
pytest.param(False, 11, None, False, id="running fleet and DEFAULT_MAX_COUNT < old_max"),
pytest.param(False, 0, None, True, id="running fleet and DEFAULT_MAX_COUNT > old_max"),
],
)
def test_max_count_policy(mocker, is_fleet_stopped, old_max, new_max, expected_result):
cluster = dummy_cluster()
cluster_has_running_capacity_mock = mocker.patch.object(
cluster, "has_running_capacity", return_value=not is_fleet_stopped
)

patch_mock = mocker.MagicMock()
patch_mock.cluster = cluster
change_mock = mocker.MagicMock()
change_mock.new_value = new_max
change_mock.old_value = old_max

assert_that(UpdatePolicy.MAX_COUNT.condition_checker(change_mock, patch_mock)).is_equal_to(expected_result)
cluster_has_running_capacity_mock.assert_called()


@pytest.mark.parametrize(
"is_fleet_stopped, key, path, old_value, new_value, update_strategy, other_changes, expected_result",
[
Expand Down

0 comments on commit 03cf55b

Please sign in to comment.