diff --git a/audit/bee b/audit/bee index 86279d6..e62919f 100755 Binary files a/audit/bee and b/audit/bee differ diff --git a/audit/internal/platform/benchmark.go b/audit/internal/platform/benchmark.go index e4cdaa0..264168e 100644 --- a/audit/internal/platform/benchmark.go +++ b/audit/internal/platform/benchmark.go @@ -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 diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 0000000..38ee9ed --- /dev/null +++ b/scripts/deploy.sh @@ -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 < Готово."