in cli/src/pcluster/config/update_policy.py [0:0]
def condition_checker_resize_update_strategy_on_remove(change, patch):
# Check if fleet is stopped
result = not patch.cluster.has_running_capacity()
# Check if the change is inside a Queue section
if not result and (is_slurm_queues_change(change) or change.key == "SlurmQueues"):
# Check if QueueUpdateStrategy is TERMINATE
result = is_resize_update_strategy_terminate(patch)
# Queue or ComputeResource can be added
if not result and change.is_list:
result = change.old_value is None and change.new_value is not None
# Check if MaxCount is increased
if not result and change.key == "MaxCount":
result = convert_value_to_int(change.new_value, DEFAULT_MAX_COUNT) >= convert_value_to_int(
change.old_value, DEFAULT_MAX_COUNT
)
# Check if MinCount is increased and MaxCount is increased of at least the same amount
if not result and change.key == "MinCount":
path = change.path
for other_change in patch.changes:
# Check the value of MaxCount next to MinCount.
# MinCount and MaxCount next to each other have the same path
if path == other_change.path and other_change.key == "MaxCount":
other_change_new_value = convert_value_to_int(other_change.new_value, DEFAULT_MAX_COUNT)
other_change_old_value = convert_value_to_int(other_change.old_value, DEFAULT_MAX_COUNT)
change_new_value = convert_value_to_int(change.new_value, DEFAULT_MIN_COUNT)
change_old_value = convert_value_to_int(change.old_value, DEFAULT_MIN_COUNT)
result = (other_change_new_value - other_change_old_value) >= (change_new_value - change_old_value)
break
return result