aboutsummaryrefslogtreecommitdiffstats
path: root/node-repository
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2020-05-06 12:50:34 +0200
committerJon Bratseth <bratseth@gmail.com>2020-05-06 12:50:34 +0200
commit3993c44146615752132084387209417cea4d8ec3 (patch)
tree181ba81b3f0e044a8352005f42d6b20e03708699 /node-repository
parenta2e37ad30ec60c4ac7c785176aee2e9fb12aa0b5 (diff)
Propagate cluster info
Diffstat (limited to 'node-repository')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocatableClusterResources.java14
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodesV2ApiHandler.java10
2 files changed, 6 insertions, 18 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocatableClusterResources.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocatableClusterResources.java
index 89207d4e23f..2704ee74c25 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocatableClusterResources.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocatableClusterResources.java
@@ -9,7 +9,6 @@ import com.yahoo.config.provision.NodeResources;
import com.yahoo.config.provision.host.FlavorOverrides;
import com.yahoo.vespa.hosted.provision.Node;
import com.yahoo.vespa.hosted.provision.NodeRepository;
-import com.yahoo.vespa.hosted.provision.applications.Cluster;
import com.yahoo.vespa.hosted.provision.provisioning.HostResourcesCalculator;
import com.yahoo.vespa.hosted.provision.provisioning.NodeResourceLimits;
@@ -21,11 +20,6 @@ import java.util.Optional;
*/
public class AllocatableClusterResources {
- // We only depend on the ratios between these values
- private static final double cpuUnitCost = 12.0;
- private static final double memoryUnitCost = 1.2;
- private static final double diskUnitCost = 0.045;
-
/** The node count in the cluster */
private final int nodes;
@@ -109,7 +103,7 @@ public class AllocatableClusterResources {
public ClusterSpec.Type clusterType() { return clusterType; }
- public double cost() { return nodes * costOf(advertisedResources); }
+ public double cost() { return nodes * advertisedResources.cost(); }
/**
* Returns the fraction measuring how well the real resources fulfils the ideal: 1 means completely fulfilled,
@@ -118,12 +112,6 @@ public class AllocatableClusterResources {
*/
public double fulfilment() { return fulfilment; }
- private static double costOf(NodeResources resources) {
- return resources.vcpu() * cpuUnitCost +
- resources.memoryGb() * memoryUnitCost +
- resources.diskGb() * diskUnitCost;
- }
-
private static double fulfilment(NodeResources realResources, NodeResources idealResources) {
double vcpuFulfilment = Math.min(1, realResources.vcpu() / idealResources.vcpu());
double memoryGbFulfilment = Math.min(1, realResources.memoryGb() / idealResources.memoryGb());
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodesV2ApiHandler.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodesV2ApiHandler.java
index 2d21ee9f45d..8e342a985ca 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodesV2ApiHandler.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/NodesV2ApiHandler.java
@@ -191,11 +191,6 @@ public class NodesV2ApiHandler extends LoggingRequestHandler {
throw new NotFoundException("Nothing at path '" + request.getUri().getPath() + "'");
}
- private HttpResponse runJob(String job) {
- nodeRepository.jobControl().run(job);
- return new MessageResponse("Executed job '" + job + "'");
- }
-
private HttpResponse handleDELETE(HttpRequest request) {
Path path = new Path(request.getUri());
if (path.matches("/nodes/v2/node/{hostname}")) return deleteNode(path.get("hostname"));
@@ -205,6 +200,11 @@ public class NodesV2ApiHandler extends LoggingRequestHandler {
throw new NotFoundException("Nothing at path '" + request.getUri().getPath() + "'");
}
+ private HttpResponse runJob(String job) {
+ nodeRepository.jobControl().run(job);
+ return new MessageResponse("Executed job '" + job + "'");
+ }
+
private HttpResponse deleteNode(String hostname) {
Optional<Node> node = nodeRepository.getNode(hostname);
if (node.isEmpty()) throw new NotFoundException("No node with hostname '" + hostname + "'");