Compare commits

...

2 Commits

Author SHA1 Message Date
Edgar Lin ddab0d2600 directly invoke one stop shop setup executable exported by vastai pip package for deployments 2026-03-25 22:41:24 -07:00
LucasArmandVast 50633c5003 Update deployments script with retries. (#81) 2026-03-23 14:58:32 -07:00
+5 -29
View File
@@ -222,42 +222,18 @@ if [ "$IS_DEPLOYMENT" = "true" ]; then
DEPLOY_DIR="/workspace/deployment"
mkdir -p "$DEPLOY_DIR"
# Download deployment code via instance API key
echo "Downloading deployment code..."
DOWNLOAD_RESPONSE=$(curl -sS \
-H "Authorization: Bearer $CONTAINER_API_KEY" \
"https://console.vast.ai/api/v0/deployment/${DEPLOYMENT_ID}/download_url/")
DOWNLOAD_URL=$(python3 -c "import sys,json; print(json.load(sys.stdin)['download_url'])" <<< "$DOWNLOAD_RESPONSE")
VAST_API_BASE="${VAST_API_BASE:-https://console.vast.ai}"
if [ -z "$DOWNLOAD_URL" ] || [ "$DOWNLOAD_URL" = "None" ]; then
report_error_and_exit "Failed to get deployment download URL"
fi
curl -sS -L "$DOWNLOAD_URL" -o "$DEPLOY_DIR/deployment.tar.gz"
cd "$DEPLOY_DIR" && tar xzf deployment.tar.gz
echo "Deployment code extracted."
# Source secrets if present
if [ -f "$DEPLOY_DIR/.secrets" ]; then
echo "Sourcing secrets..."
source "$DEPLOY_DIR/.secrets"
fi
# Run on_start.sh to completion if present
if [ -f "$DEPLOY_DIR/on_start.sh" ]; then
echo "Running on_start.sh..."
chmod +x "$DEPLOY_DIR/on_start.sh"
bash "$DEPLOY_DIR/on_start.sh"
echo "on_start.sh completed."
fi
# Download deployment code, retrying until the blob is available on S3.
# The s3_key exists in the DB as soon as the deployment is created, but the
# actual upload may still be in flight from the client side.
# Install SDK (uses the install_vastai_sdk function which supports SDK_BRANCH/SDK_VERSION)
install_vastai_sdk
# Run deployment in serve mode
export VAST_DEPLOYMENT_MODE=serve
echo "Starting deployment: python3 $DEPLOY_DIR/deployment.py"
python3 "$DEPLOY_DIR/deployment.py"
serve-vast-deployment
exit $?
fi
# ─── End SDK Deployment Mode ───────────────────────────────────────────