Skip to content

Commit

Permalink
Merge pull request #32953 from vespa-engine/bratseth/simplify-allocat…
Browse files Browse the repository at this point in the history
…ion-error

Simplify allocation error
  • Loading branch information
hmusum authored Nov 27, 2024
2 parents 7289777 + 95f6458 commit 07b3189
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.provision.autoscale;

import com.yahoo.config.provision.IntRange;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.Capacity;
import com.yahoo.config.provision.ClusterResources;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.IntRange;
import com.yahoo.config.provision.NodeResources;
import com.yahoo.vespa.hosted.provision.NodeRepository;
import com.yahoo.vespa.hosted.provision.applications.Cluster;
Expand Down Expand Up @@ -80,7 +80,8 @@ private double between(double min, double max, double value) {
@Override
public String toString() {
if (isEmpty()) return "no limits";
return "limits: from " + min + " to " + max + ( groupSize.isEmpty() ? "" : " with group size " + groupSize);
return (min.equals(max) ? "resources " + min : "limits from " + min + " to " + max) +
(groupSize.isEmpty() ? "" : ", group size " + groupSize);
}

public static Limits of(Cluster cluster) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ private static NodeResources requireCompatibleResources(NodeResources nodeResour
}

private IllegalArgumentException newNoAllocationPossible(ClusterSpec spec, Limits limits) {
StringBuilder message = new StringBuilder("No allocation possible within ").append(limits);
StringBuilder message = new StringBuilder("No allocation possible with ").append(limits);

if (nodeRepository.exclusivity().allocation(spec) && findNearestNodeResources(limits).isPresent())
message.append(". Nearest allowed node resources: ").append(findNearestNodeResources(limits).get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public void capacity_is_in_advertised_amounts() {
}
catch (IllegalArgumentException e) {
// Success
String expected = "No allocation possible within limits";
String expected = "No allocation possible with limits";
assertEquals(expected, e.getMessage().substring(0, expected.length()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import com.yahoo.component.Version;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ApplicationMutex;
import com.yahoo.config.provision.ApplicationName;
import com.yahoo.config.provision.ApplicationTransaction;
import com.yahoo.config.provision.Capacity;
Expand All @@ -15,7 +16,6 @@
import com.yahoo.config.provision.NodeAllocationException;
import com.yahoo.config.provision.NodeResources;
import com.yahoo.config.provision.NodeType;
import com.yahoo.config.provision.ApplicationMutex;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.TenantName;
Expand Down Expand Up @@ -548,7 +548,7 @@ public void too_few_real_resources_causes_failure() {
new ClusterResources(4, 1, resources)));
}
catch (IllegalArgumentException e) {
assertEquals("No allocation possible within limits: " +
assertEquals("No allocation possible with limits " +
"from 2 nodes with [vcpu: 1.0, memory: 5.0 Gb, disk: 10.0 Gb, bandwidth: 1.0 Gbps, architecture: any] " +
"to 4 nodes with [vcpu: 1.0, memory: 5.0 Gb, disk: 10.0 Gb, bandwidth: 1.0 Gbps, architecture: any]",
e.getMessage());
Expand All @@ -572,7 +572,7 @@ public void exclusive_resources_not_matching_host_causes_failure() {
new ClusterResources(4, 1, resources)));
}
catch (IllegalArgumentException e) {
assertEquals("No allocation possible within limits: " +
assertEquals("No allocation possible with limits " +
"from 2 nodes with [vcpu: 20.0, memory: 37.0 Gb, disk: 100.0 Gb, bandwidth: 1.0 Gbps, architecture: any] " +
"to 4 nodes with [vcpu: 20.0, memory: 37.0 Gb, disk: 100.0 Gb, bandwidth: 1.0 Gbps, architecture: any]. " +
"Nearest allowed node resources: [vcpu: 20.0, memory: 40.0 Gb, disk: 100.0 Gb, bandwidth: 1.0 Gbps, storage type: remote, architecture: any]",
Expand Down

0 comments on commit 07b3189

Please sign in to comment.