Version 1 checkpoint
This commit is contained in:
@@ -9,6 +9,25 @@ load_runtime_env
|
||||
|
||||
mkdir -p "$STATE_DIR/run" "$STATE_DIR/logs"
|
||||
|
||||
ensure_transformerlab_default_user() {
|
||||
local helper_python="${TRANSFORMERLAB_DIR}/envs/transformerlab/bin/python"
|
||||
|
||||
if [ ! -x "$helper_python" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -z "${TRANSFORMERLAB_DEFAULT_USER_EMAIL:-}" ] || [ -z "${TRANSFORMERLAB_DEFAULT_USER_PASSWORD:-}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
"$helper_python" "$SCRIPT_DIR/ensure_transformerlab_user.py" \
|
||||
--transformerlab-dir "$TRANSFORMERLAB_DIR" \
|
||||
--email "$TRANSFORMERLAB_DEFAULT_USER_EMAIL" \
|
||||
--password "$TRANSFORMERLAB_DEFAULT_USER_PASSWORD" \
|
||||
--first-name "${TRANSFORMERLAB_DEFAULT_USER_FIRST_NAME:-Student}" \
|
||||
--last-name "${TRANSFORMERLAB_DEFAULT_USER_LAST_NAME:-}" >>"$STATE_DIR/logs/transformerlab_default_user.log" 2>&1 || true
|
||||
}
|
||||
|
||||
resolve_targets() {
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "No target specified." >&2
|
||||
@@ -57,10 +76,13 @@ service_ready() {
|
||||
ollama)
|
||||
curl -fsS "$(service_url "$service")/api/tags" >/dev/null 2>&1
|
||||
;;
|
||||
transformerlab)
|
||||
curl -fsS "$(service_url "$service")/healthz" >/dev/null 2>&1
|
||||
;;
|
||||
promptfoo)
|
||||
curl -fsS "$(service_url "$service")/health" >/dev/null 2>&1
|
||||
;;
|
||||
open-webui|transformerlab|chunkviz|embedding-atlas|unsloth|wiki)
|
||||
open-webui|chunkviz|embedding-atlas|unsloth|wiki)
|
||||
curl -fsS "$(service_url "$service")" >/dev/null 2>&1
|
||||
;;
|
||||
*)
|
||||
@@ -75,13 +97,20 @@ start_one() {
|
||||
local log_file
|
||||
local pid_file
|
||||
local attempt
|
||||
local pid_grace_attempts=5
|
||||
|
||||
if has_live_pid "$service"; then
|
||||
if [ "$service" = "transformerlab" ]; then
|
||||
ensure_transformerlab_default_user
|
||||
fi
|
||||
echo "$service already running"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if service_ready "$service"; then
|
||||
if [ "$service" = "transformerlab" ]; then
|
||||
ensure_transformerlab_default_user
|
||||
fi
|
||||
echo "$service already available"
|
||||
return 0
|
||||
fi
|
||||
@@ -90,6 +119,24 @@ start_one() {
|
||||
open-webui)
|
||||
start_one ollama
|
||||
;;
|
||||
transformerlab)
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
python3 "$SCRIPT_DIR/repair_transformerlab_plugin_supports.py" \
|
||||
--transformerlab-dir "$TRANSFORMERLAB_DIR" \
|
||||
--plugin "fastchat_server" \
|
||||
--required-support "chat" \
|
||||
--required-support "completion" \
|
||||
--required-support "visualize_model" \
|
||||
--required-support "model_layers" \
|
||||
--required-support "rag" \
|
||||
--required-support "tools" \
|
||||
--required-support "template" \
|
||||
--required-support "embeddings" \
|
||||
--required-support "tokenize" \
|
||||
--required-support "logprobs" \
|
||||
--required-support "batched" >>"$STATE_DIR/logs/transformerlab_plugin_supports.log" 2>&1 || true
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
@@ -98,7 +145,12 @@ start_one() {
|
||||
log_file=$(service_log_file "$service")
|
||||
pid_file=$(service_pid_file "$service")
|
||||
|
||||
if command -v setsid >/dev/null 2>&1; then
|
||||
if [ "$service" = "ollama" ]; then
|
||||
env \
|
||||
OLLAMA_HOST="${COURSEWARE_BIND_HOST}:${COURSEWARE_OLLAMA_PORT}" \
|
||||
OLLAMA_MODELS="$OLLAMA_MODELS_DIR" \
|
||||
"$OLLAMA_BIN" serve </dev/null >>"$log_file" 2>&1 &
|
||||
elif command -v setsid >/dev/null 2>&1; then
|
||||
nohup setsid bash -lc "$cmd" </dev/null >>"$log_file" 2>&1 &
|
||||
else
|
||||
nohup bash -lc "$cmd" </dev/null >>"$log_file" 2>&1 &
|
||||
@@ -107,14 +159,19 @@ start_one() {
|
||||
|
||||
for attempt in $(seq 1 60); do
|
||||
if service_ready "$service"; then
|
||||
if [ "$service" = "transformerlab" ]; then
|
||||
ensure_transformerlab_default_user
|
||||
fi
|
||||
echo "started $service"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if ! has_live_pid "$service"; then
|
||||
rm -f "$pid_file"
|
||||
echo "failed to start $service; check $log_file" >&2
|
||||
exit 1
|
||||
if [ "$attempt" -ge "$pid_grace_attempts" ]; then
|
||||
rm -f "$pid_file"
|
||||
echo "failed to start $service; check $log_file" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
|
||||
Reference in New Issue
Block a user