Make local inference limits and workstation setup reproducible
This commit is contained in:
1 parent
7006991843
commit
8544abd2d4
28 files changed
+1022
-21
No files matched your search
@@ -15,25 +15,25 @@ bad() { printf '✗ %s\n' "$*"; failures=$((failures + 1)); }
|
||||
source "$CONFIG_FILE"
|
||||
|
||||
for command in git curl jq tar zstd systemctl hermes; do
|
||||
command -v "$command" >/dev/null 2>&1 && ok "$command vorhanden" || bad "$command fehlt"
|
||||
if command -v "$command" >/dev/null 2>&1; then ok "$command vorhanden"; else bad "$command fehlt"; fi
|
||||
done
|
||||
|
||||
for script in "$HOME/.local/libexec"/hermes-stack-*; do
|
||||
[[ -f "$script" ]] || continue
|
||||
bash -n "$script" && ok "Syntax: ${script##*/}" || bad "Syntaxfehler: ${script##*/}"
|
||||
if bash -n "$script"; then ok "Syntax: ${script##*/}"; else bad "Syntaxfehler: ${script##*/}"; fi
|
||||
done
|
||||
|
||||
if [[ -d "$HERMES_REPO/.git" ]]; then
|
||||
ok "Hermes-Git-Checkout vorhanden"
|
||||
dirty="$(git -C "$HERMES_REPO" status --porcelain --untracked-files=all |
|
||||
grep -vxF '?? .install_method' || true)"
|
||||
[[ -z "$dirty" ]] && ok "Hermes-Checkout sauber" || bad "Hermes-Checkout enthält lokale Änderungen"
|
||||
if [[ -z "$dirty" ]]; then ok "Hermes-Checkout sauber"; else bad "Hermes-Checkout enthält lokale Änderungen"; fi
|
||||
else
|
||||
bad "Hermes-Git-Checkout fehlt"
|
||||
fi
|
||||
|
||||
systemctl --user is-active --quiet "$GATEWAY_SERVICE" && ok "Gateway aktiv" || bad "Gateway inaktiv"
|
||||
hermes gateway status >/dev/null 2>&1 && ok "Gateway gesund" || bad "Gateway-Status fehlgeschlagen"
|
||||
if systemctl --user is-active --quiet "$GATEWAY_SERVICE"; then ok "Gateway aktiv"; else bad "Gateway inaktiv"; fi
|
||||
if hermes gateway status >/dev/null 2>&1; then ok "Gateway gesund"; else bad "Gateway-Status fehlgeschlagen"; fi
|
||||
|
||||
if curl --fail --silent --max-time 5 "$LLAMA_URL/health" |
|
||||
jq -e '.status == "ok"' >/dev/null 2>&1; then
|
||||
@@ -51,7 +51,7 @@ set -u
|
||||
if [[ -n "${SIGNAL_HTTP_URL:-}" ]]; then
|
||||
status="$(curl --silent --output /dev/null --max-time 5 --write-out '%{http_code}' \
|
||||
"${SIGNAL_HTTP_URL%/}/api/v1/check" || true)"
|
||||
[[ "$status" =~ ^2[0-9][0-9]$ ]] && ok "signal-cli HTTP erreichbar" || bad "signal-cli HTTP nicht erreichbar"
|
||||
if [[ "$status" =~ ^2[0-9][0-9]$ ]]; then ok "signal-cli HTTP erreichbar"; else bad "signal-cli HTTP nicht erreichbar"; fi
|
||||
fi
|
||||
|
||||
printf '\nFehler: %d\n' "$failures"
|
||||
|
||||
@@ -24,7 +24,7 @@ flock -n 9 || {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# shellcheck disable=SC1090
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
source "$config_dir/llama.env"
|
||||
[[ -n "${LLAMA_PROFILE:-}" ]] || {
|
||||
printf 'Profilbetrieb ist nicht konfiguriert.\n' >&2
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
set -Euo pipefail
|
||||
config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/hermes-stack-maintenance"
|
||||
if [[ -r "$config_dir/config.env" ]]; then
|
||||
# shellcheck disable=SC1090
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
source "$config_dir/config.env"
|
||||
fi
|
||||
printf '\nGPU (Gesamtspeicher, belegt, frei in MiB):\n'
|
||||
|
||||
@@ -8,7 +8,7 @@ if [[ "${1:-}" != --jobs-finished || $# -ne 1 ]]; then
|
||||
fi
|
||||
|
||||
config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/hermes-stack-maintenance"
|
||||
# shellcheck disable=SC1090
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
source "$config_dir/config.env"
|
||||
|
||||
exec 8>"${XDG_RUNTIME_DIR:-/tmp}/hermes-stack-hermes-update.lock"
|
||||
|
||||
@@ -27,7 +27,7 @@ while (($#)); do
|
||||
done
|
||||
|
||||
if [[ -n "${LLAMA_PROFILE:-}" && -r "$config_dir/llama-profile.env" ]]; then
|
||||
# shellcheck disable=SC1090
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
source "$config_dir/llama-profile.env"
|
||||
fi
|
||||
[[ -z "$profile_override" ]] || LLAMA_PROFILE="$profile_override"
|
||||
@@ -70,6 +70,9 @@ if [[ -n "${LLAMA_MMPROJ:-}" ]]; then
|
||||
fi
|
||||
[[ -z "${LLAMA_ALIAS:-}" ]] || model_args+=(--alias "$LLAMA_ALIAS")
|
||||
|
||||
# Server defaults are not a wall-clock limit; the independent slot watchdog is.
|
||||
[[ "${LLAMA_MAX_OUTPUT_TOKENS:-2048}" =~ ^[1-9][0-9]*$ ]] || exit 2
|
||||
|
||||
profile_args=()
|
||||
if [[ -n "${LLAMA_PROFILE:-}" ]]; then
|
||||
reasoning_budget=512
|
||||
@@ -107,6 +110,7 @@ args=(
|
||||
"${model_args[@]}"
|
||||
--host "${LLAMA_HOST:-127.0.0.1}"
|
||||
--port "${LLAMA_PORT:-8080}"
|
||||
--n-predict "${LLAMA_MAX_OUTPUT_TOKENS:-2048}"
|
||||
"${profile_args[@]}"
|
||||
"${LLAMA_ARGS[@]}"
|
||||
)
|
||||
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
umask 077
|
||||
config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/hermes-stack-maintenance"
|
||||
set -a
|
||||
# shellcheck disable=SC1091
|
||||
source "$config_dir/config.env"
|
||||
set +a
|
||||
exec 9>"${XDG_RUNTIME_DIR:-/tmp}/hermes-stack-hermes-update.lock"
|
||||
flock -n 9 || exit 0
|
||||
exec python3 "$HOME/.local/lib/hermes-stack/llama_watchdog.py"
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
# Explicit model selection. Stops current gateway requests; keeps both model files.
|
||||
set -Eeuo pipefail
|
||||
umask 077
|
||||
config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/hermes-stack-maintenance"
|
||||
usage() {
|
||||
printf 'Aufruf: %s [status|routine|large] (Modellwechsel beendet laufende Anfragen)\n' "$0"
|
||||
}
|
||||
case "${1:-}" in
|
||||
''|status)
|
||||
# shellcheck disable=SC1091
|
||||
source "$config_dir/llama.env"
|
||||
printf 'Aktives Modell: %s\nKonfiguration: %s/llama.env\n' "$LLAMA_MODEL" "$config_dir"
|
||||
exit 0 ;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
routine|large) selected="$1" ;;
|
||||
*) usage >&2; exit 2 ;;
|
||||
esac
|
||||
[[ $# -eq 1 ]] || exit 2
|
||||
exec 9>"${XDG_RUNTIME_DIR:-/tmp}/hermes-stack-hermes-update.lock"
|
||||
flock -n 9 || { printf 'Maintenance läuft.\n' >&2; exit 1; }
|
||||
runner="$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")/hermes-stack-llama-run"
|
||||
candidate="$config_dir/llama-$selected.env"
|
||||
HERMES_LLAMA_CONFIG="$candidate" "$runner" --check
|
||||
backup="$(mktemp "$config_dir/llama.env.before-model-switch.XXXXXX")"
|
||||
cp -p -- "$config_dir/llama.env" "$backup"
|
||||
systemctl --user stop hermes-gateway.service
|
||||
rollback() {
|
||||
local rc=$?
|
||||
trap - EXIT
|
||||
if ((rc != 0)); then
|
||||
install -m 0600 "$backup" "$config_dir/llama.env" || true
|
||||
systemctl --user restart llama-qwen.service || true
|
||||
systemctl --user start hermes-gateway.service || true
|
||||
printf 'Modellwechsel fehlgeschlagen; vorherige Konfiguration zurückkopiert. Dienststatus prüfen.\n' >&2
|
||||
fi
|
||||
exit "$rc"
|
||||
}
|
||||
trap rollback EXIT
|
||||
install -m 0600 "$candidate" "$config_dir/llama.env"
|
||||
ready=0
|
||||
if systemctl --user restart llama-qwen.service; then
|
||||
for ((i=0; i<90; i++)); do
|
||||
if curl -fsS --max-time 2 http://127.0.0.1:8080/health | jq -e '.status == "ok"' >/dev/null 2>&1; then
|
||||
ready=1; break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
fi
|
||||
if ((ready == 0)); then
|
||||
exit 1
|
||||
fi
|
||||
systemctl --user start hermes-gateway.service
|
||||
trap - EXIT
|
||||
printf 'Modellprofil %s aktiv. Vorherige Konfiguration: %s\n' "$selected" "$backup"
|
||||
Reference in new issue
Block a user