Skip to content

Commit

Permalink
fix(bid-script/gpu): take into account the service count (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
andy108369 authored Nov 16, 2023
1 parent 037b2fc commit 31f9c4c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions charts/akash-provider/scripts/price_script_generic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# WARNING: the runtime of this script should NOT exceed 5 seconds! (Perhaps can be amended via AKASH_BID_PRICE_SCRIPT_PROCESS_TIMEOUT env variable)
# Requirements:
# curl jq bc mawk ca-certificates
# Version: Sept-19-2023
# Version: November-16-2023
set -o pipefail

# Example:
Expand Down Expand Up @@ -159,17 +159,19 @@ fi

gpu_price_total=0
while IFS= read -r resource; do
count=$(echo "$resource" | jq -r '.count')
model=$(echo "$resource" | jq -r '.gpu.attributes.vendor.nvidia.model // 0')
gpu_units=$(echo "$resource" | jq -r '.gpu.units // 0')
# default to 100 USD/GPU per unit a month when PRICE_TARGET_GPU_MAPPINGS is not set
price="${gpu_mappings[''$model'']:-$gpu_unit_max_price}"
((gpu_price_total += gpu_units * price))
((gpu_price_total += count * gpu_units * price))

if ! [[ -z $DEBUG_BID_SCRIPT ]]; then
echo "DEBUG: model $model"
echo "DEBUG: price for this model $price"
echo "DEBUG: gpu_units $gpu_units"
echo "DEBUG: gpu_price_total $gpu_price_total"
echo "DEBUG: count $count"
fi
done <<< "$(echo "$data_in" | jq -rc '.[]')"

Expand Down

0 comments on commit 31f9c4c

Please sign in to comment.