summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorØyvind Grønnesby <oyving@yahooinc.com>2023-03-13 09:43:03 +0100
committerØyvind Grønnesby <oyving@yahooinc.com>2023-03-13 09:50:07 +0100
commit49d4352d9fb20a213b62ee19ffef5098f9900a56 (patch)
treeb295f615f09ffe3653b9fd47335ec82e60e2cfaa /controller-api
parent6feab455a0d91b10f18c1dcb2cd4a3d051bc1c6c (diff)
Propagate GPU values to bills
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Bill.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Bill.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Bill.java
index 854413a4adb..9c29f5c30f4 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Bill.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/Bill.java
@@ -116,6 +116,10 @@ public class Bill {
return sumResourceValues(LineItem::getDiskCost);
}
+ public BigDecimal sumGpuCost() {
+ return sumResourceValues(LineItem::getGpuCost);
+ }
+
public BigDecimal sumAdditionalCost() {
// anything that is not covered by the cost for resources is "additional" costs
var resourceCosts = sumCpuCost().add(sumMemoryCost()).add(sumDiskCost());
@@ -185,9 +189,11 @@ public class Bill {
private BigDecimal cpuHours;
private BigDecimal memoryHours;
private BigDecimal diskHours;
+ private BigDecimal gpuHours;
private BigDecimal cpuCost;
private BigDecimal memoryCost;
private BigDecimal diskCost;
+ private BigDecimal gpuCost;
private NodeResources.Architecture architecture;
private int majorVersion;
@@ -201,7 +207,7 @@ public class Bill {
}
public LineItem(String id, String description, BigDecimal amount, String plan, String agent, ZonedDateTime addedAt, ZonedDateTime startedAt, ZonedDateTime endedAt, ApplicationId applicationId, ZoneId zoneId,
- BigDecimal cpuHours, BigDecimal memoryHours, BigDecimal diskHours, BigDecimal cpuCost, BigDecimal memoryCost, BigDecimal diskCost, NodeResources.Architecture architecture, int majorVersion) {
+ BigDecimal cpuHours, BigDecimal memoryHours, BigDecimal diskHours, BigDecimal gpuHours, BigDecimal cpuCost, BigDecimal memoryCost, BigDecimal diskCost, BigDecimal gpuCost, NodeResources.Architecture architecture, int majorVersion) {
this(id, description, amount, plan, agent, addedAt);
this.startedAt = startedAt;
this.endedAt = endedAt;
@@ -214,11 +220,13 @@ public class Bill {
this.cpuHours = cpuHours;
this.memoryHours = memoryHours;
this.diskHours = diskHours;
+ this.gpuHours = gpuHours;
this.cpuCost = cpuCost;
this.memoryCost = memoryCost;
this.diskCost = diskCost;
this.architecture = architecture;
this.majorVersion = majorVersion;
+ this.gpuCost = gpuCost;
}
/** The opaque ID of this */
@@ -283,6 +291,10 @@ public class Bill {
return Optional.ofNullable(diskHours);
}
+ public Optional<BigDecimal> getGpuHours() {
+ return Optional.ofNullable(gpuHours);
+ }
+
public Optional<BigDecimal> getCpuCost() {
return Optional.ofNullable(cpuCost);
}
@@ -295,6 +307,10 @@ public class Bill {
return Optional.ofNullable(diskCost);
}
+ public Optional<BigDecimal> getGpuCost() {
+ return Optional.ofNullable(gpuCost);
+ }
+
public Optional<NodeResources.Architecture> getArchitecture() {
return Optional.ofNullable(architecture);
}