Use last ramp-step SDR snapshot for PSU loaded power; add deploy script
- benchmark.go: retain sdrLastStep from final ramp step instead of re-sampling after test when GPUs are already idle - scripts/deploy.sh: build+deploy bee binary to remote host over SSH Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4268,6 +4268,10 @@ func (s *System) RunNvidiaPowerBench(ctx context.Context, baseDir string, opts N
|
||||
// per-step in NvidiaPowerBenchStep.ServerLoadedW.
|
||||
var serverLoadedW float64
|
||||
var serverLoadedOK bool
|
||||
// sdrLastStep retains the SDR snapshot from the last ramp step while GPUs are
|
||||
// still loaded. Used as PSUInputLoadedW in the summary instead of re-sampling
|
||||
// after the test when GPUs have already returned to idle.
|
||||
var sdrLastStep sdrPowerSnapshot
|
||||
|
||||
// Step 1: reuse single-card calibration result directly.
|
||||
if len(result.RecommendedSlotOrder) > 0 {
|
||||
@@ -4431,6 +4435,7 @@ func (s *System) RunNvidiaPowerBench(ctx context.Context, baseDir string, opts N
|
||||
if step == len(result.RecommendedSlotOrder) {
|
||||
serverLoadedW = sdrStep.PSUInW
|
||||
serverLoadedOK = true
|
||||
sdrLastStep = sdrStep
|
||||
}
|
||||
} else if stepIPMIOK && serverIdleOK && stepIPMILoadedW > 0 {
|
||||
ramp.ServerLoadedW = stepIPMILoadedW
|
||||
@@ -4501,7 +4506,9 @@ func (s *System) RunNvidiaPowerBench(ctx context.Context, baseDir string, opts N
|
||||
// Supplement DCMI with SDR multi-source data via collector's PSU slot patterns.
|
||||
// Per-slot readings enable correlation with audit HardwarePowerSupply entries.
|
||||
if result.ServerPower != nil {
|
||||
sdrLoaded := sampleIPMISDRPowerSensors()
|
||||
// Use the SDR snapshot from the last ramp step (GPUs still loaded) rather
|
||||
// than re-sampling here, which would capture post-test idle state.
|
||||
sdrLoaded := sdrLastStep
|
||||
result.ServerPower.PSUInputIdleW = sdrIdle.PSUInW
|
||||
result.ServerPower.PSUInputLoadedW = sdrLoaded.PSUInW
|
||||
result.ServerPower.PSUOutputIdleW = sdrIdle.PSUOutW
|
||||
|
||||
64
scripts/deploy.sh
Executable file
64
scripts/deploy.sh
Executable file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
REMOTE_USER="bee"
|
||||
REMOTE_BIN="/usr/local/bin/bee"
|
||||
LOCAL_BIN="audit/bee"
|
||||
SERVICES="bee-audit bee-web"
|
||||
|
||||
# --- IP ---
|
||||
if [[ $# -ge 1 ]]; then
|
||||
HOST="$1"
|
||||
else
|
||||
read -rp "IP адрес хоста: " HOST
|
||||
fi
|
||||
[[ -z "$HOST" ]] && { echo "Ошибка: IP не указан"; exit 1; }
|
||||
|
||||
# --- SSH options ---
|
||||
SSH_OPTS=(-o StrictHostKeyChecking=no -o ConnectTimeout=10)
|
||||
|
||||
# Проверяем, нужен ли пароль
|
||||
SSH_PASS=""
|
||||
if ! ssh "${SSH_OPTS[@]}" -o BatchMode=yes "${REMOTE_USER}@${HOST}" true 2>/dev/null; then
|
||||
if command -v sshpass &>/dev/null; then
|
||||
read -rsp "Пароль для ${REMOTE_USER}@${HOST}: " SSH_PASS
|
||||
echo
|
||||
SSH_CMD=(sshpass -p "$SSH_PASS" ssh "${SSH_OPTS[@]}")
|
||||
SCP_CMD=(sshpass -p "$SSH_PASS" scp "${SSH_OPTS[@]}")
|
||||
else
|
||||
echo "sshpass не установлен. Введите пароль вручную при запросе (или установите SSH-ключ)."
|
||||
SSH_CMD=(ssh "${SSH_OPTS[@]}")
|
||||
SCP_CMD=(scp "${SSH_OPTS[@]}")
|
||||
fi
|
||||
else
|
||||
SSH_CMD=(ssh "${SSH_OPTS[@]}")
|
||||
SCP_CMD=(scp "${SSH_OPTS[@]}")
|
||||
fi
|
||||
|
||||
REMOTE="${REMOTE_USER}@${HOST}"
|
||||
|
||||
# --- Build ---
|
||||
echo "==> Сборка бинарника..."
|
||||
(
|
||||
cd audit
|
||||
VERSION=$(sh ./scripts/resolve-version.sh 2>/dev/null || echo "dev")
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
||||
go build -ldflags "-X main.Version=${VERSION}" -o bee ./cmd/bee
|
||||
)
|
||||
echo " OK: $(ls -lh "${LOCAL_BIN}" | awk '{print $5, $9}')"
|
||||
|
||||
# --- Deploy ---
|
||||
echo "==> Копирование на ${REMOTE}..."
|
||||
"${SCP_CMD[@]}" "${LOCAL_BIN}" "${REMOTE}:/tmp/bee-new"
|
||||
|
||||
echo "==> Замена бинарника и перезапуск сервисов..."
|
||||
"${SSH_CMD[@]}" "$REMOTE" bash -s <<EOF
|
||||
set -e
|
||||
sudo mv /tmp/bee-new ${REMOTE_BIN}
|
||||
sudo chmod +x ${REMOTE_BIN}
|
||||
sudo systemctl restart ${SERVICES}
|
||||
sleep 2
|
||||
systemctl status ${SERVICES} --no-pager -l
|
||||
EOF
|
||||
|
||||
echo "==> Готово."
|
||||
Reference in New Issue
Block a user