Skip to content

Commit 9057fcb

Browse files
committed
fix: worker billing pricing issue
1 parent e116cfe commit 9057fcb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/controller/tensorfusioncluster_controller.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"context"
2121
"fmt"
2222
"strconv"
23+
"strings"
2324
"sync"
2425

2526
"golang.org/x/time/rate"
@@ -444,6 +445,7 @@ func (r *TensorFusionClusterReconciler) SetupWithManager(mgr ctrl.Manager, addLi
444445

445446
// Update metrics recorder's raw billing map
446447
func (r *TensorFusionClusterReconciler) updateMetricsRecorder(ctx context.Context, pool *tfv1.GPUPool) {
448+
const dollarSign = "$"
447449
log := log.FromContext(ctx)
448450
if pool.Spec.QosConfig == nil {
449451
log.Info("QosConfig is nil, skip updating metrics recorder", "pool", pool.Name)
@@ -456,8 +458,8 @@ func (r *TensorFusionClusterReconciler) updateMetricsRecorder(ctx context.Contex
456458
}
457459
pricingDetail := r.MetricsRecorder.WorkerUnitPriceMap[pool.Name]
458460
for _, pricing := range qosConfig.Pricing {
459-
tflopsPerHour, _ := strconv.ParseFloat(pricing.Requests.PerFP16TFlopsPerHour, 64)
460-
vramPerHour, _ := strconv.ParseFloat(pricing.Requests.PerGBOfVRAMPerHour, 64)
461+
tflopsPerHour, _ := strconv.ParseFloat(strings.TrimPrefix(pricing.Requests.PerFP16TFlopsPerHour, dollarSign), 64)
462+
vramPerHour, _ := strconv.ParseFloat(strings.TrimPrefix(pricing.Requests.PerGBOfVRAMPerHour, dollarSign), 64)
461463
limitOverRequestChargingRatio, _ := strconv.ParseFloat(pricing.LimitsOverRequestsChargingRatio, 64)
462464

463465
pricingDetail[string(pricing.Qos)] = metrics.RawBillingPricing{

0 commit comments

Comments
 (0)